Skip to main content
added 12 characters in body
Source Link
Netwave
  • 43.2k
  • 6
  • 69
  • 111

Use sets:

C = list(set(A) - set(B)) 

In case you want to mantain duplicates and/or oder:

filter_set = set(B) C = [x for x in A if x not in filter_set] 

Use sets:

C = list(set(A) - set(B)) 

In case you want to mantain duplicates:

filter_set = set(B) C = [x for x in A if x not in filter_set] 

Use sets:

C = list(set(A) - set(B)) 

In case you want to mantain duplicates and/or oder:

filter_set = set(B) C = [x for x in A if x not in filter_set] 
added 117 characters in body
Source Link
Netwave
  • 43.2k
  • 6
  • 69
  • 111

Use sets:

C = list(set(A) - set(B)) 

In case you want to mantain duplicates:

filter_set = set(B) C = [x for x in A if x not in filter_set] 

Use sets:

C = list(set(A) - set(B)) 

Use sets:

C = list(set(A) - set(B)) 

In case you want to mantain duplicates:

filter_set = set(B) C = [x for x in A if x not in filter_set] 
Source Link
Netwave
  • 43.2k
  • 6
  • 69
  • 111

Use sets:

C = list(set(A) - set(B))