如何在python中使用标志位:
1 # __author:"Cheng" 2 # date:2018/2/12 3 4 exit_flag = False #设置标志为False 5 6 for i in range(10): 7 if i < 5: 8 continue 9 print(i) 10 for j in range(10): 11 print("层", j) 12 if j == 6: 13 exit_flag = True #当j == 6时,标志为True状态 14 break 15 16 if exit_flag: #如果标志为True,执行下面的break 17 break