失败重试
时间:2020-11-19 09:33:53
收藏:0
阅读:27
RETRY_TIMES = 5
def try_work():
for i in range(RETRY_TIMES):
try:
print(‘这里是要执行的函数‘)
print(‘第--{}--次尝试,成功了。。。‘.format(i + 1))
return True
except:
print(‘第--{}--次尝试,失败了。。。‘.format(i + 1))
return False
try_work()
这里是要执行的函数
第--1--次尝试,成功了。。。
原文:https://www.cnblogs.com/hui-code/p/14003248.html
评论(0)