参考链接: Python Set union()
两个给定集合的并集是包含两个集合的所有元素的最小集合。...两个给定集合A和B的并集是一个由A的所有元素和B的所有元素组成的集合,这样就不会重复任何元素。
表示集合并集的符号是“ U”。...用法:
set1.union(set2, set3, set4….)
...以下是上述方法的Python3实现:
# Python3 program for union() function
set1 = {2, 4, 5, 6}
set2 = {4, 6, 7, 8}... set3 = {7, 8, 9, 10}
# union of two sets
print("set1 U set2:", set1.union(set2))
# union of three