Iteration Classes
itertools.product()
Produce Cartesian products, with the rightmost pool advancing fastest. Inputs are stored in finite pools before results are yielded.
Formal Syntax & Structure
python syntaxpython
itertools.product(*iterables, repeat=1)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterables | iterable | Zero or more input iterables. |
| repeat | int | Number of repetitions of the input pools. |
Return Value
iterator
The iterator result described above.
Working Example
Example Snippetpython
import itertoolsprint(list(itertools.product([1,2],"AB")))