python 使用for 实现死循环
code
import time #—————————————————————————————————————————————— #死循环打印1 ''' def count_n1(): return 1 for i in iter(count_n1, 6): print(i) ''' #—————————————————————————————————————————————— #打印 # 1 # 2 # 3 # 4 # 5 n=0 def count_n2(): global n n=n+1 return n for i in iter(count_n2, 6): print(i)