LANGUAGE » PYTHON

Iterator

Usage

Convert an iterator to a list:

python
mylist = list(iterator)

Loop through an iterator:

python
for element in iterator:
  pass

Get the first (next) element of an iterator:

python
element = next(iterator)