本文介绍了跳过Python中的迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有循环,但是循环内部可能会引发异常。这当然会一起阻止我的程序。为了防止我捕获异常并处理它们。但是,即使发生异常,迭代的其余部分也会运行。是否有一个关键字可以在我的中使用,除了:
子句只是跳过当前迭代的其余部分?
I have a loop going, but there is the possibility for exceptions to be raised inside the loop. This of course would stop my program all together. To prevent that I catch the exceptions and handle them. But then the rest of the iteration runs even though an exception occurred. Is there a keyword to use in my except:
clause to just skip the rest of the current iteration?
推荐答案
您正在寻找。
这篇关于跳过Python中的迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!