itertools.cycle().next()?

前端 未结 2 1206
醉酒成梦
醉酒成梦 2020-12-05 12:59

Well, I was using itertools.cycle().next() method with Python 2.6.6, but now that I updated to 3.2 I noticed that itertools.cycle() object has no m

2条回答
  •  既然无缘
    2020-12-05 13:38

    In Python 3.x, iterators don't have it.next() any more. use next(it) instead, which also works in Python 2.6 or above. Internally, this will call it.next() in Python 2.x and it.__next__() in Python 3.x.

提交回复
热议问题