Iteration Methods
itertools.chain.from_iterable()
Flatten one level from an iterable of iterables, obtaining each inner iterable lazily.
Formal Syntax & Structure
python syntaxpython
itertools.chain.from_iterable(iterable, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterable | iterable | Input values, consumed as needed. |
Return Value
iterator
The iterator result described above.
Working Example
Example Snippetpython
import itertoolsprint(list(itertools.chain.from_iterable([[1],[2,3]])))