Administrator
发布于 2026-06-17 / 0 阅读
0
0

03-异常-传递性

异常传递性

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

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


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


main()

评论