About catching ANY exception

后端 未结 8 1061
一整个雨季
一整个雨季 2020-11-22 07:23

How can I write a try/except block that catches all exceptions?

8条回答
  •  伪装坚强ぢ
    2020-11-22 08:01

    You can do this to handle general exceptions

    try:
        a = 2/0
    except Exception as e:
        print e.__doc__
        print e.message
    

提交回复
热议问题