Python 循环中使用 continue 语句
continue 语句
使用 continue 语句,我们可以停止当前循环的迭代,并继续下一个迭代。
示例
不要打印 banana
fruits = ["apple", "banana", "cherry"]
for x in fruits
if x == "banana"
continue
print(x)
自己尝试 »
使用 continue 语句,我们可以停止当前循环的迭代,并继续下一个迭代。
不要打印 banana
fruits = ["apple", "banana", "cherry"]
for x in fruits
if x == "banana"
continue
print(x)
自己尝试 »
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]
If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]