Should I always specify an exception type in `except` statements?

前端 未结 7 1087
广开言路
广开言路 2020-11-22 15:33

When using PyCharm IDE the use of except: without an exception type triggers a reminder from the IDE that this exception clause is Too broad.

7条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 15:54

    Try this:

    try:
        #code
    except ValueError:
        pass
    

    I got the answer from this link, if anyone else run into this issue Check it out

提交回复
热议问题