enumerate()(Python)

>>> E=enumerate('spam')
>>> E
<enumerate object at 0x1021ceca8>
>>> I=iter(E)
>>> next(I)
(0, 's')
>>> next(I)
(1, 'p')
>>> list(enumerate('spam'))
[(0, 's'), (1, 'p'), (2, 'a'), (3, 'm')]

next(I)I__next__()效果相同。

原文地址:https://www.cnblogs.com/yaos/p/6985322.html