📜  python 默认错误处理程序 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:33.550000             🧑  作者: Mango

代码示例2
import sys
def my_except_hook(exctype, value, traceback):
    if exctype == KeyboardInterrupt:
        print "Handler code goes here"
    else:
        sys.__excepthook__(exctype, value, traceback)
sys.excepthook = my_except_hook