break和continue示例:

注: break是停止,continue是跳过继续

vi aa.py

#!/usr/bin/python

print("break------------------") count=0 while count<5: print("aaa",count) count+=1 if count==2: break print("bbb",count)

print("continue------------------") count=0 while count<5: print("aaa",count) count+=1 if count==2: continue print("bbb",count)

:wq

python aa.py