python for...else 与while...else

原文链接: https://www.runoob.com/python/python-for-loop.html

在 python 中,for … else 表示这样的意思,for 中的语句和普通的没有区别,else 中的语句会在循环正常执行完(即 for 不是通过 break 跳出而中断的)的情况下执行,while … else 也是一样。

猜你喜欢

转载自blog.csdn.net/lyc0424/article/details/102663933