try: pass#要执行的代码 except: 状态=True while 状态==True: try: winsound.Beep(800, 1000)#报警提示音 循环=300 while 循环>1: 循环-=1 time.sleep(1) print(‘等待时间还剩%s秒‘%循环) pass#要执行的代码 状态=False except: 状态=True
Python while循环实现重试
原文:https://www.cnblogs.com/zhangdingqu/p/9311436.html