Sử dụng >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
0 mà không có biểu hiện lambda
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
Khi sử dụng các chức năng như
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
1 hoặc >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
0 và tương tự từ >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
3, bạn thường có thể tiết kiệm hiệu suất bằng cách tránh các biểu hiện ____ 14 và sử dụng các chức năng đã có. Các trường hợp của >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
5 và >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
6 xác định một phương pháp 17 17 để sử dụng để kiểm tra ngăn chặn. Người vận hành ____ 18 gọi phương pháp này dưới mui xe, do đó, sử dụng >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
9 có thể được thay thế bằng $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
0. Thông thường sự thay thế này không thực sự đẹp hơn nhưng trong trường hợp cụ thể này, nó cho phép chúng tôi đạt được hiệu suất tốt hơn so với sử dụng biểu hiện ____ 14, khi được sử dụng kết hợp với >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
0:>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = [2, 3, 5, 8]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
0 tạo ra một trình lặp mang lại tất cả các yếu tố trả về $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
4 khi được sử dụng làm đối số cho $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
5.Các bộ có triển khai nhanh hơn
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
7 vì vậy thậm chí còn tốt hơn là:>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
Màn biểu diễn
Sử dụng danh sách:
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
Sử dụng tập hợp:
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
Sử dụng Filter [] + Lambda để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác ..How to remove the elements of a list from another list in Python.
Sử dụng Remove [] để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác ..
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]
Sử dụng Set [] để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác ..
Bạn có thể xóa một danh sách khỏi danh sách trong Python không?
Python3
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
7$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
0$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
4$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
8____39Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]0
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
9Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]3
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
8 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
59Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]3
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]6
Đầu ra: & nbsp;
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]
Sử dụng Filter [] + lambda để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác & nbsp;
Hàm bộ lọc có thể được sử dụng cùng với Lambda để thực hiện nhiệm vụ này và tạo một danh sách được lọc mới của tất cả các phần tử không có trong danh sách phần tử Xóa.
Python3
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
7$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
0$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
4$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
8____39Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]0
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
9Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]9
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
1Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
4 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
14The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
8Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]3
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]6
Đầu ra: & nbsp;
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]
Sử dụng Filter [] + lambda để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác & nbsp;
Hàm bộ lọc có thể được sử dụng cùng với Lambda để thực hiện nhiệm vụ này và tạo một danh sách được lọc mới của tất cả các phần tử không có trong danh sách phần tử Xóa.
Python3
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
7$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
0$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
4$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
8____39Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]0
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
9Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]9
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
1Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
4 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
14The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
8>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
60>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
61>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
62>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
63>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
64Sử dụng Remove [] để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác & NBSP;
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
63>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
69Xóa [] cũng có thể thực hiện nhiệm vụ này nhưng chỉ khi ngoại trừ việc không nhận được các yếu tố cụ thể được xử lý đúng cách. Người ta có thể lặp lại cho tất cả các yếu tố của danh sách đã xóa và xóa các yếu tố đó khỏi danh sách ban đầu. & NBSP;
The original list is : [1, 3, 4, 6, 7]
The original list is : [3, 6]
The list after performing remove operation is : [1, 4, 7]
2 The original list is : [1, 3, 4, 6, 7]
The original list is : [3, 6]
The list after performing remove operation is : [1, 4, 7]
3
8 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
59 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
60>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
66 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
67
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]3
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
Python3
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
7$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
0$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
4$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
8____39Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]0
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
9Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]9
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
1Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
4 >>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
14The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
8Sử dụng Remove [] để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác & NBSP;
Xóa [] cũng có thể thực hiện nhiệm vụ này nhưng chỉ khi ngoại trừ việc không nhận được các yếu tố cụ thể được xử lý đúng cách. Người ta có thể lặp lại cho tất cả các yếu tố của danh sách đã xóa và xóa các yếu tố đó khỏi danh sách ban đầu. & NBSP;
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]3
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]6
Đầu ra: & nbsp;
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]
Sử dụng Filter [] + lambda để xóa tất cả các giá trị khỏi danh sách có trong danh sách khác & nbsp; to remove all values from a list present in other list
Hàm bộ lọc có thể được sử dụng cùng với Lambda để thực hiện nhiệm vụ này và tạo một danh sách được lọc mới của tất cả các phần tử không có trong danh sách phần tử Xóa.remove the elements of a list from another list in Python.
Python3
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
7$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
0$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
4$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
8____39$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
7$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
0$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
4$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
8____39Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]0
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8 $ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
9$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
2$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
1$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
6$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
1000000 loops, best of 5: 359 nsec per loop
9Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]2
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]9
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]8
$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
64$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
8>>> from itertools import filterfalse
>>> l1 = [1, 2, 6, 8]
>>> l2 = set[[2, 3, 5, 8]]
>>> list[filterfalse[l2.__contains__, l1]]
[1, 6]
5$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
67$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
68$ python3 -m timeit -s "from itertools import filterfalse; l1 = [1,2,6,8]; l2 = set[[2,3,5,8]];" "list[filterfalse[l2.__contains__, l1]]"
500000 loops, best of 5: 522 nsec per loop
69Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]7
Input: List one is : [1, 3, 4, 6, 7] List two is : [3, 6] Output: The list after performing the remove operation is : [1, 4, 7]8
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]3
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]0
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]1
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]6
Output:
The original list is : [1, 3, 4, 6, 7] The original list is : [3, 6] The list after performing remove operation is : [1, 4, 7]