a=[1,2,3,4]
b=[3,4,5,6]
jiaoji=[i for i in a if i in b]
print("a和b的交集:%s" % jiaoji)
bingji=list(set(a).union(set(b)))
print("a和b的并集: %s" % bingji)
chaji=set(a).difference(set(b))
print("a和b的差集:%s" %chaji)
chaji2=set(b).difference(set(a))
print("b和a的差集:%s" % chaji2)