Skip to content

Instantly share code, notes, and snippets.

@bearqq
Created June 19, 2017 06:39
Show Gist options
  • Save bearqq/9926187a457ecb2745d72bc17dcaf92a to your computer and use it in GitHub Desktop.
Save bearqq/9926187a457ecb2745d72bc17dcaf92a to your computer and use it in GitHub Desktop.
retry
for _ in range(0,retry_times):
try:
dosomething()
break#执行成功,跳出 for
except:
continue
else:#for 执行完毕未跳出,即错误次数超出
raise RetryException()
return
return "success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment