只需使用该
.union()方法即可。
>>> l = [set([1,2,3]), set([4,5,6]), set([1,4,9])]>>> frozenset().union(*l)frozenset([1, 2, 3, 4, 5, 6, 9])
这适用于任何可迭代的迭代器。

只需使用该
.union()方法即可。
>>> l = [set([1,2,3]), set([4,5,6]), set([1,4,9])]>>> frozenset().union(*l)frozenset([1, 2, 3, 4, 5, 6, 9])
这适用于任何可迭代的迭代器。