【发布时间】:2014-12-24 17:24:00
【问题描述】:
我正在尝试以下列方式捕获 SystemExit 异常:
try:
raise SystemExit
except Exception as exception:
print "success"
但是,它不起作用。
但是当我像这样更改我的代码时它确实有效:
try:
raise SystemExit
except:
print "success"
据我所知,except Exception as exception 应该会捕获任何异常。这也是here 的描述方式。为什么这里不适合我?
【问题讨论】:
标签: python exception exception-handling