Python cycle Iterator
Python cycle(iterable)
iterates through the iterable over and over again till break
stops the loop.
>>> from itertools import * >>> x = cycle('01') >>> j = 1; >>> for i in x: ... print(i,j) ... j += 1 ... if (j == 7): ... break ...
0 1 1 2 0 3 1 4 0 5 1 6