class Getoutforloop(Exception):
pass
if __name__ == '__main__':
try:
for i in range(10):
for j in range(10):
if i==5 and j==4:
raise Getoutforloop()
else:
print('i=={},j=={}'.format(i,j))
except Getoutforloop:
pass
print("ok")
python 跳出多重循环
最新推荐文章于 2021-01-14 03:35:16 发布