How can I find the union on a list of sets in Python? [duplicate]
Solution 1:
The signature of set.union
is union(other, ...)
. Unpack sets from your list:
In [6]: set.union(*x)
Out[6]: {1, 2, 3, 4, 5}
The signature of set.union
is union(other, ...)
. Unpack sets from your list:
In [6]: set.union(*x)
Out[6]: {1, 2, 3, 4, 5}