异常后如何重试? - How to retry after exception?

问题:

I have a loop starting with for i in range(0, 100) .我有一个以for i in range(0, 100)开头的循环。 Normally it runs correctly, but sometimes it fails due to network conditions.通常它运行正常,但有时会由于网络条件而失败。 Currently I have it set so that on failure, it will continue in the except clause (continue on to the next number for i ).目前我已经设置了它,以便在失败时,它将continue在 except 子句中(继续到i的下一个数字)。

Is it possible for me to reassign the same number to i and run through the failed iteration of the loop again?我是否可以将相同的数字重新分配给i并再次运行失败的循环迭代?


解决方案:

参考一: https://stackoom.com/question/8k8h
参考二: How to retry after exception?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章