【发布时间】:2017-03-05 17:27:17
【问题描述】:
是否有某种方法可以检查 Python 循环内的 while 循环条件是否仍然为真?像这样的:
i = 0
while i < 2:
i = 2
evalcond
print("This executes because the condition is still true at this point")
这可能吗?
【问题讨论】:
-
看起来你想要一个
while 1:和if:... break结构。
标签: python python-3.x while-loop conditional-statements