Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 291 Bytes

File metadata and controls

20 lines (14 loc) · 291 Bytes

异常传递性

通过异常具有传递性的特点,我们可以在外层调用处去捕获异常

def test_func():
    print("执行start...")
    1 / 0
    print("执行end...")


def main():
    try:
        test_func()
    except Exception as e:
        print(e)


main()