Skip to main content
 首页 » 编程设计

python之如何在 Python 中创建无限循环(不使用 while 循环)

2025年05月04日8powertoolsteam

<分区>

有没有办法在 Python 中编写一个无限循环?

for t in range(0,10): 
    if(t == 9): t= 0 # will this set t to 0 and launch infinite loop? No! 
    print(t) 

一般来说,有没有办法在不使用 while 循环的情况下像 java 一样编写无限的 pythonic for 循环?