>>> 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__()效果相同。

>>> 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__()效果相同。

相关文章:

  • 2021-04-13
  • 2022-01-22
  • 2021-12-08
  • 2021-08-23
  • 2021-12-10
  • 2022-02-17
猜你喜欢
  • 2022-01-04
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案