python break

count =0
for x in 'abcefg':
    count = 0
    while count<10:
        print x+str(count)
        count +=1
        if count ==5:
            break

			
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/core/a4.py
a0
a1
a2
a3
a4
b0
b1
b2
b3
b4
c0
c1
c2
c3
c4
e0
e1
e2
e3
e4
f0
f1
f2
f3
f4
g0
g1
g2
g3
g4

Process finished with exit code 0

break 可以结束当前循环然后跳转到下条语句

原文地址:https://www.cnblogs.com/hzcya1995/p/13349159.html