【发布时间】:2014-03-22 17:53:09
【问题描述】:
我正在尝试执行使用两个嵌套循环的 Python 脚本。
第一个是 for 和第二个(嵌套的一个是 while)。
这是我的代码:
for currentData in data:
currentState = ''
count = 0
while currentState == '':
currentState = someMetdhodExecution() ...
count++
当我将while 放入for 中时,脚本崩溃。
请帮我解决这个问题。
提前谢谢你!
【问题讨论】:
-
请格式化您的代码。使用四个空格将行标记为代码。
-
count++语法无效。 -
“崩溃”是什么意思?
-
请准确说明错误。 Python 会为您生成详细的错误回溯,您应该在此处显示。
-
count++ -> count += 1
标签: python loops for-loop while-loop