ID EN
Itertools

from_iterable

Python 3.11

Alternate constructor for chain(). Gets chained inputs from a single iterable argument that is evaluated lazily. Roughly equivalent to:

Syntax

PYTHON
classmethod chain.from_iterable(iterable)

Examples

Example 1
PYTHON
def from_iterable(iterables):
     chain.from_iterable(['ABC', 'DEF']) --> A B C D E F
    for it in iterables:
        for element in it:
            yield element

See Also

chain()