异常处理
捕获所有异常
捕捉特定异常
引发异常
重新抛出异常
定义异常类型
保证执行代码
如果没有发生异常
方法抛出异常
class
SimpleException
(Exception):
pass
raise
SimpleException
(
"Oops!"
)
# <-Error