About catching ANY exception

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

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

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 08:00

    try:
        whatever()
    except:
        # this will catch any exception or error
    

    It is worth mentioning this is not proper Python coding. This will catch also many errors you might not want to catch.

提交回复
热议问题