我需要循环浏览一个列表,以便在1-4 使用之间起始位置itertools我可以在列表中循环
1-4
itertools
positions = itertools.cycle([1,2,3,4]) next(positions)
这确实会返回下一个位置,但下次我需要从3开始怎么办?如何设置起始位置?
我需要经常更改起始位置,我不能将列表更改为从3开始.
python python-itertools python-3.x
python ×1
python-3.x ×1
python-itertools ×1