在Python中,我们可以编写两种异常处理逻辑
第一个是空的,除了:
try:
do_something()
except:
error_handling()另一个是第一个宽的,除了:
try:
do_something()
except Exception:
error_handling()它们之间的实际区别是什么?
发布于 2020-04-24 01:11:00
exception层次结构的顶部不是Exception,而是BaseException,它有四个子类:
ExceptionGeneratorExitSystemExitKeyboardInterrupt裸except:等同于except BaseException:。
https://stackoverflow.com/questions/61392936
复制相似问题