Python while循环实现重试

try:
    pass#要执行的代码
except:
    状态=True
    while 状态==True:
        try:
            winsound.Beep(800, 1000)#报警提示音
            循环=300
            while 循环>1:
                循环-=1
                time.sleep(1)
                print('等待时间还剩%s秒'%循环)
            pass#要执行的代码
            状态=False
        except:
            状态=True

  

posted @ 2018-07-15 00:15  zhangdingqu  阅读(676)  评论(0编辑  收藏  举报