PyDocs

Nav

Functional Programming Modules

tee

itertools

function
  • tee(iterable, n=2)
Returns a tuple of n independent iterators.
1 Example
>>> iterator = iter('abcdef')
>>> [iterator] = tee(iterator, 1)   # Make the input peekable
>>> next(iterator)                  # Move the iterator forward
'a'
>>> lookahead(iterator)             # Check next value
'b'
>>> next(iterator)                  # Continue moving forward
'b'
from the Python docs
See Also
No see-alsos for itertools/tee
0 Notes
No notes for tee