黄舟2017-04-17 17:42:38
Try again in except.
try:
语句A
except Exception as e:
try:
语句A
except Exception as e:
# 继续
But this is stupid. If you really want to implement an infinite loop to catch exceptions, write like this:
def func():
try:
语句A
except Exception as e:
return False
else:
return True
while not func():
pass # Or do something
PHP中文网2017-04-17 17:42:38
According to the way you write it, the error should be ignored and statement A should be executed?
Written specifically by yourself.
循环:
try:
语句A
except:
pass #这是忽略错误
ringa_lee2017-04-17 17:42:38
Why is there such a strange demand? You should consider changing the direction. This is obviously an endless loop