python 跳出多层循环的办法,使用flag,

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ifubing/article/details/85017218
one = ['a','b','c','d']
two = [1,2,3,4]

flag = False

for i in one:
    if flag == True:
        break
    print i

    if i == 'b':
        for m in two:
            print m
            if m == 3:
                flag = True
                break





猜你喜欢

转载自blog.csdn.net/ifubing/article/details/85017218
今日推荐