try:
# 尝试执行的代码
except 错位类型1:
# 捕获异常时执行的代码
except Exception as msg:
# 捕获未知错误
else:
# 没有异常时的代码
finally:
# 无论有没有异常都执行
python学习 - 异常 - 完整结构
猜你喜欢
转载自blog.csdn.net/weixin_38892128/article/details/86597321
今日推荐
周排行