📌  相关文章
📜  python 列表中的下一项 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:19.523000             🧑  作者: Mango

代码示例1
# credit to Stack Overflow user in the source link

from itertools import cycle

li = [0, 1, 2, 3]

running = True
licycle = cycle(li)

nextelem = next(licycle)

while running:
    thiselem, nextelem = nextelem, next(licycle)