“继续"的示例使用Python 中的语句? [英] Example use of "continue" statement in Python?
本文介绍了“继续"的示例使用Python 中的语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
continue 的定义代码>语句是:
continue
语句继续循环的下一次迭代.
The
continue
statement continues with the next iteration of the loop.
我找不到任何好的代码示例.
I can't find any good examples of code.
有人可以建议一些需要 continue
的简单情况吗?
Could someone suggest some simple cases where continue
is necessary?
推荐答案
这是一个简单的例子:
for letter in 'Django':
if letter == 'D':
continue
print("Current Letter: " + letter)
输出将是:
Current Letter: j
Current Letter: a
Current Letter: n
Current Letter: g
Current Letter: o
它继续循环的下一次迭代.
It continues to the next iteration of the loop.
这篇关于“继续"的示例使用Python 中的语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文