python 求两个list的差集、并集与交集
1.差集
a = [1,2,3] b = [2,3] c = list(set(b).difference(set(a))) # b中有而a中没有的
2 .并集
c = list(set(a).union(set(b)))
3.交集
c=list(set(a).intersection(set(b)))
1.差集
a = [1,2,3] b = [2,3] c = list(set(b).difference(set(a))) # b中有而a中没有的
2 .并集
c = list(set(a).union(set(b)))
3.交集
c=list(set(a).intersection(set(b)))