python中居然没有跳出多层循环的标准语法
[root@shuffle-dev py_test]$ vim sf_breakN.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 for i in range(1,5):
5 for j in range(1,5):
6 for k in range(1,5):
7 if i==j==k==2:
8 break #break1
9 else:
10 print i,'---',j,'---',k
11 else:
12 continue
13 break #break2
14 else:
15 continue
16 break #break 3
网友评论