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 跳出多重循环
最新推荐文章于 2022-06-15 15:07:40 发布
3478

被折叠的 条评论
为什么被折叠?



