python打印异常代码行数

IT小君   2021-09-04T08:36:25
print('异常信息:\n%s' % traceback.format_exc())

打印信息如下:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "E:/procedure/python/shopSpider/videoSpider.py", line 180, in getPlayInfo
    ses.commit()

 

 
点击广告,支持我们为你提供更好的服务
评论(28)