打破两个循环

buz*_*zsh 1 python break while-loop

我正在while循环中编写带有while循环的代码,并且我想知道如果我在内循环中遇到必要的条件,如何突破外循环.

while N <= 8:
    while i < 60:
        if this:
            that
        elif this:
            that other thing
        else:
            break
        i += 1
    if while loop has found the right thing:
        N += 1
    else:
        change conditions
Run Code Online (Sandbox Code Playgroud)

这个break命令只会突破第一个循环,所以我想知道如何简单地打破这两个循环.值得一提的是,所有这些都在另一个for循环中,我不想打破.谢谢.

Álv*_*mez 6

将它封装在一个函数中并在完成后返回?