<分区>
异常处理的典型结构如下:
try:
pass
except Exception, e:
raise
else:
pass
finally:
pass
我可以知道 except Exception, e:
或 except Exception as e:
是什么意思吗?
通常我会使用 print (e)
来打印错误消息,但我想知道程序做了什么来生成 e。
如果我以另一种方式构建它(如下),它会是什么样子?
except Exception:
e = Exception.something
替换东西
的方法应该是什么?
当try
下的代码体没有异常时,程序将执行else
下的代码。但是,finally
在这里做了什么?