try..exception as e,请问如何获取完整的异常类名称方式?

查看 51|回复 1
作者:qazwsxkevin   
try:
   xxxxxx
except Exception as e:
   # print(e)
   print(type(e))              # output:
   print(e.__class__.__name__) # output:ProgrammingError
请问在这种情景下,如何能获得'MySQLdb.ProgrammingError'完整的字符串?

print, MySQLdb, Exception, output

Vegetable   
f"{e.__class__.__module__}.{e.__class__.__name__}"
您需要登录后才可以回帖 登录 | 立即注册

返回顶部