Iteration Classes
itertools.pairwise()
Emit overlapping successive pairs, producing one fewer pair than input items.
Formal Syntax & Structure
python syntaxpython
itertools.pairwise(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.pairwise([4,7,9])))