Python learning --enumerate

enumerate(seq, start)

seq - sequence may traverse start - start position subscript

. 1 SEQ = [11,22,33,44,55 ]
 2  for I in SEQ:
 . 3      Print (the seq. Index (I), I)
 . 4  
. 5  for I, Item in the enumerate (SEQ): # is mainly used to traverse, and outputs the index and data
 . 6      Print (I, Item)

Output:

0 11
1 22
2 33
3 44
4 55
0 11
1 22
2 33
3 44
4 55

 

Guess you like

Origin www.cnblogs.com/jcxioo/p/11586661.html