其他分享
首页 > 其他分享> > 11.8 traceback模块的使用

11.8 traceback模块的使用

作者:互联网

 

import traceback
try:
    print('-------------------------')
    print(1/0)
except:
    traceback.print_exc()
    #print('有异常')
E:\PycharmProjects\pythonProject\venv\Scripts\python.exe E:/PycharmProjects/pythonProject/demon1/demo36.py
-------------------------
Traceback (most recent call last):
  File "E:/PycharmProjects/pythonProject/demon1/demo36.py", line 4, in <module>
    print(1/0)
ZeroDivisionError: division by zero

进程已结束,退出代码0

 

标签:py,pythonProject,traceback,demo36,模块,PycharmProjects,print,11.8
来源: https://www.cnblogs.com/988MQ/p/16678293.html