try:except ValueError:except (ZeroDivisionError,ValueError):except Exception as result: print(result)else:#没有异常执行finally:#无论有无异常都执行
#异常的传递性 def f(): pass def test(): return f() try: test() except Exception as result: print(result)
本文共 299 字,大约阅读时间需要 1 分钟。
try:except ValueError:except (ZeroDivisionError,ValueError):except Exception as result: print(result)else:#没有异常执行finally:#无论有无异常都执行
#异常的传递性 def f(): pass def test(): return f() try: test() except Exception as result: print(result)
转载于:https://www.cnblogs.com/5014sy/p/9956654.html