Can I get the exception from the finally block in python?

前端 未结 4 889
夕颜
夕颜 2020-12-04 23:56

I have a try/finally clause in my script. Is it possible to get the exact error message from within the finally clause?

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 00:20

    You'll want to do that in the except clause, not the finally.

    Refer to: http://www.doughellmann.com/articles/Python-Exception-Handling/

提交回复
热议问题