【发布时间】:2020-10-27 00:11:18
【问题描述】:
我正在记录我的代码中的任何错误,我尝试过使用:
try:
#some deliberately dodgy code
Except Exception:
print(Exception) #i am actually passing this to a function to add it in a file
但我得到的只是:
【问题讨论】:
-
except Exception as e: ; print(e) -
异常是一个类。在 except 子句中,您应该有
Exception as e才能打印它。
标签: python python-3.x