# Interface Return value List1 = [ ' John Doe ' , ' John Doe ' , ' Wang Wu ' , ' second child ' ] # database Return value List2 = [ ' John Doe ' , ' John Doe ' , ' second child ' , ' Wang seven ' ] A = [X for X in List1 IF X in List2] # two tables listing the presence of B = [Y for Y in(List1 + List2) IF Y Not in A] # two different list elements Print ( ' A value: ' , A) Print ( ' B values: ' , B) C = [X for X in list1 IF X not in list2] # not in the list in the list1 list2 list D = [Y for Y in list2 IF Y not in list1] # not in the list in the list1 list2 list Print ( ' C values:' , C) Print ( ' d has a value: ' , d)
Output
a values: [ ' John Doe ' , ' John Doe ' , ' second child ' ] B values: [ ' Wang Wu ' , ' King seven ' ] C values: [ ' Wang Wu ' ] D in values: [ ' King seven ' ]