1 class Infinit: 2 def __iter__(self): 3 return self 4 5 def __next__(self): 6 return None 7 8 for i in Infinit(): 9 print("好嗨哟,你是不是学会了for的无限循环!")
python for 无限循环
原文:https://www.cnblogs.com/linkenpark/p/10950495.html