Iteration Classes
itertools.chain()
Traverse each iterable in order without constructing a combined list.
Formal Syntax & Structure
python syntaxpython
itertools.chain(*iterables)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterables | iterable | Zero or more input iterables. |
Return Value
iterator
The iterator result described above.
Working Example
Example Snippetpython
import itertoolsprint(list(itertools.chain([1,2],[],[3])))