Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

itertools .cycle()

def cycle(iterable):
    # cycle('ABCD') --> A B C D A B C D A B C D ...
    saved = []
    for element in iterable:
        yield element
        saved.append(element)
    while saved:
        for element in saved:
              yield element
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #itertools
ADD COMMENT
Topic
Name
7+1 =