python-异常处理

python-异常处理_第1张图片

python-异常处理_第2张图片 

# try :
#     print(name)
# except NameError:
#     print("有问题")

#
# try:
#     1 / 0
# except ZeroDivisionError as ze:
#     print("xxxx", ze)
# except NameError as ne:
#     print("666",ne)
# else:
#     print("123")
# finally:
#     print("最后")



# try:
#     1 / 0
#     print(name)
# except (ZeroDivisionError,NameError):
#     print("xxxx")
# else:
#     print("123")
# finally:
#     print("最后")

 

你可能感兴趣的:(python,前端,开发语言)