python determine elements of the two lists are not all the same

# List. 1
List1 = [ 'John Doe', 'John Doe', 'Wang Wu', 'second child']
# listing 2
List2 = [ 'John Doe', 'John Doe', 'second child', 'WANG seven ']

a = [X for X in X IF in List1 List2] # two tables listing the presence of
b = [y for y in ( list1 + list2) if y not in a] # two different elements in the list of

print ( 'a value:', a)
Print ( 'B values:', B)

C = [X for X X not IF in list1 in list2] # list1 not in the list, the list list2
d = [y for y in list2 if y not in list1] # list1 list but not in the list, list2
print ( 'c values:', C)
( 'd values of:', d) print

Guess you like

Origin www.cnblogs.com/aixiao07/p/11268193.html