import itertools
iter = itertools.count(start=0, step=1)
next(iter) \\ 0
next(iter) \\ 1
next(iter) \\ 2
next(iter) \\ 3
itertools.count()
is to generate continuous integers, the default step is 1
and the default started number is 0
, you can adjust it by your preference.
But warning: if you close the program and restart it, the number will be begin with start
, not the prcedding of the last number when we closed the program.
I have not yet found the way to continue to count the number since the program closed and restarted.