python集合set,交集,并集,差集,对称差集,子集和超集 x = {1, 2, 3, 4} y = {2, 4, 5, 6} # 交集(取x中与y中相同部分) print(x.intersection(y)) print(x & y) # 并集(去重合并) print(x.union(y)) print(x | y) # 差集(x在y中不同部分,相反) print(x.difference(y)) # {1, 3} print(y.difference(x)) # {5,6} print(…