list_1 = set([1, 5, 3, 6, 8]) list_2 = set([2, 4, 5, 8, 6]) #交集 # print(list_1.intersection(list_2)) & # {8, 5, 6}
#并集 # print(list_1.union(list_2)) | # {1, 2, 3, 4, 5, 6, 8}
#差集(in list_1 not in list_2) - # print(list_1.difference(list_2)) # {1, 3}
#子集 # print(list_1.issubset(list_2)) # False
#父集 # print(list_1.issuperset(list_2)) # False
#对称差集(去重) ^ # print(list_1.symmetric_difference(list_2)) # {1, 2, 3, 4}