atexit

    4熱度

    3回答

    正如你所看到的,即使在程序死亡之後,它也會從墳墓中發出。是否有辦法在異常情況下「撤銷」退出功能? import atexit def helloworld(): print("Hello World!") atexit.register(helloworld) raise Exception("Good bye cruel world!") 輸出 Traceback (m