February 2006
Intermediate to advanced
648 pages
14h 53m
English
The itertools module contains functions for creating efficient iterators, useful for looping over data in various ways. All the functions in this module return iterators that can be used with the for statement and other functions involving iterators.
chain(iter1, iter2, ..., iterN)
Given a group of iterators (iter1,..., iterN), this function creates a new iterator that chains all the iterators together. The returned iterator produces items from iter1 until it is exhausted. Then items from iter2 are produced. This continues until all the items in iterN are exhausted.
count([n])Creates an iterator that produces consecutive integers starting with n. If n is omitted, counting starts at 0. (Note that this iterator does not support long ...
Read now
Unlock full access