定位错误行,并纪录日志

用到模块tracebackcode

代码utf-8

#coding:utf-8
import traceback

def x():
    try:
        i = 5/0
    except Exception,e:
        print e
        traceback.print_exc(file=open('errMsg.log','a'))

if __name__ == '__main__':
    x()
相关文章
相关标签/搜索