itertools - count

  • count

  • Unbound counter: Count from N to infinity.


examples/iterators/count.py

import itertools

for c in itertools.count(start=19, step=1):
    print(c)
    if c > 23:
        break

# 19
# 20
# 21
# 22
# 23
# 24