如何制作';继续';语句循环使用;“母亲”;在找到语句的循环外循环?(Python)
我有一个这样的代码:如何制作';继续';语句循环使用;“母亲”;在找到语句的循环外循环?(Python),python,for-loop,continue,Python,For Loop,Continue,我有一个这样的代码: for-loop1: for-loop2: if-statement: continue <code here> <code there> for-loop1: for-loop2: 如果声明: 持续 问题是,如何使continue语句迭代for-loop1而不仅仅是for-loop2?将语句与for-loop2行对齐将迭代for-loop1,甚至不首先执行其余代
for-loop1:
for-loop2:
if-statement:
continue
<code here>
<code there>
for-loop1:
for-loop2:
如果声明:
持续
问题是,如何使continue语句迭代for-loop1而不仅仅是for-loop2?将语句与for-loop2行对齐将迭代for-loop1,甚至不首先执行其余代码。帮助:(如果
for-loop2
之后没有代码,则中断将有效地重新启动外部循环
for-loop1:
for-loop2:
if-statement:
break
<code here>
<code there>
for-loop1:
for-loop2:
如果声明:
打破
如果在内部循环之后有额外的东西,那么需要更多的操作
for-loop1:
restart_loop1 = False
for-loop2:
if-statement:
restart_loop1 = True
break
<code here>
<code there>
if restart_loop1:
continue
<more code here>
for-loop1:
重新启动\u loop1=False
for-loop2:
如果声明:
重新启动\u loop1=True
打破
如果重新启动\u loop1:
持续
这将终止程序还是只终止for-loop2?我正在执行一个文件处理程序,很难跟踪,因为目前我没有获得所有正确的输出。:/尝试理解代码。这将终止内部循环。