python traceback

Posted 时光荏苒,白驹过隙。且行且珍惜!!!

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python traceback相关的知识,希望对你有一定的参考价值。

try:
  xxxx

except Exception as e:
  print(e)



#此处返回的只是一个异常错误  





import  traceback

try:

  xxxx

except:

  traceback.print_exc()      #可以加参数写成报错日志 traceback.print_exc(file=open(‘error.txt‘,‘a‘))
#可以提示 准确在哪一行有错误 

 

以上是关于python traceback的主要内容,如果未能解决你的问题,请参考以下文章

Python 处理异常栈模块——traceback 模块

python笔记71 - traceback.print_exc()保存异常内容

python运行后显示Traceback (most recent call last):啥意思?

python初学者Traceback (most recent call last):

python自动化Traceback (most recent call last):报错

python之traceback