Just use the .union()
method.
>>> l = [set([1,2,3]), set([4,5,6]), set([1,4,9])]
>>> frozenset().union(*l)
frozenset([1, 2, 3, 4, 5, 6, 9])
This works for any iterable of iterables.
More Related Contents:
- Python: powerset of a given set with generators [duplicate]
- Understanding generators in Python
- Lazy Method for Reading Big File in Python?
- Difference between Python’s Generators and Iterators
- How is set() implemented?
- Best way to find the intersection of multiple sets?
- How do I know if a generator is empty from the start?
- Resetting generator object in Python
- What makes sets faster than lists?
- Why can a Python dict have multiple keys with the same hash?
- Can iterators be reset in Python?
- Converting “yield from” statement to Python 2.7 code
- Add list to set
- How to len(generator()) [duplicate]
- Python generator that groups another iterable into groups of N
- Are sets ordered like dicts in python3.6
- Length of generator output [duplicate]
- How to get the n next values of a generator in a list (python)
- How can I generate all possible IPs from a list of ip ranges in Python?
- Python set interpetation of 1 and True
- Python: using a recursive algorithm as a generator
- Set iteration order varies from run to run
- Return in generator together with yield
- What does the “yield” keyword do in Python?
- Get difference between two lists with Unique Entries
- How to clone a Python generator object?
- Why do list comprehensions write to the loop variable, but generators don’t? [duplicate]
- How does a Python set([]) check if two objects are equal? What methods does an object need to define to customise this?
- Making a sequence of tuples unique by a specific element
- How to retrieve an element from a set without removing it?