On the iterative tool python itertool

1 Overview

. 1  the Python built itertools module provides useful functions for manipulating objects iteration.
2  
3  First, we look at a few "unlimited" iterator itertools offered:
 4   Import itertools
 5   natuals = itertools.count (1 ) #   Print (dir (itertools)) to print out all the methods under the itertools 
6 for the n- in natuals :
7    Print (the n-) 
8 # execution result 1,2,3,4 ... infinite iterations down Ctrl + c to exit the loop

 See: Https://Www.Liaoxuefeng.Com/wiki/897692888725344/983420006222912

Guess you like

Origin www.cnblogs.com/jum-bolg/p/11094637.html