try:
code
except (Error1,Errror2) as e: #抓住目标错误
print("error error error" , e)
except Exception as e: #抓住所有错误
print("未知错误" , e)
else:
print("一切正常")
finally:
print("不管有错没错,都执行")
2023-11-25 10:59:09
try:
code
except (Error1,Errror2) as e: #抓住目标错误
print("error error error" , e)
except Exception as e: #抓住所有错误
print("未知错误" , e)
else:
print("一切正常")
finally:
print("不管有错没错,都执行")