【发布时间】:2021-06-23 22:47:02
【问题描述】:
我如何编写一段代码来识别是否发生了任何类型的错误,如果发生了,代码只是在循环中运行。我会在<some error occurs> 中放置什么函数,以便识别任何错误 0 输出并在 10 秒内重新运行代码。
while True:
<all your code>
if <some error occurs>:
time.sleep(10)
continue
【问题讨论】:
标签: python error-handling while-loop compiler-errors output