In Python, enumerate() function is an improvement over regular iteration.
The enumerate() function returns an iterator that gives (0, item[0]).
E.g.
>>> thelist=[‘a’,’b’]
>>> for i,j in enumerate(thelist):
print i,j
0 a
1 b
In Python, enumerate() function is an improvement over regular iteration.
The enumerate() function returns an iterator that gives (0, item[0]).
E.g.
>>> thelist=[‘a’,’b’]
>>> for i,j in enumerate(thelist):
print i,j
0 a
1 b
by
Tags:
Leave a Reply