Python try/except: Showing the cause of the error after displaying my variables

前端 未结 7 833
萌比男神i
萌比男神i 2020-12-24 05:51

I\'m not even sure what the right words are to search for. I want to display parts of the error object in an except block (similar to the err object in VBScript, which has E

7条回答
  •  没有蜡笔的小新
    2020-12-24 06:21

    In other words,

    try:
        1/0
    except Exception as e:
        print e
    

    You can get the details in the manual pages linked by Ignacio in his response.

提交回复
热议问题