以下两段代码都做同样的事情.它们捕获每个异常并执行except:块中的代码
小片1 -
try:
#some code that may throw an exception
except:
#exception handling code
Run Code Online (Sandbox Code Playgroud)
小片2 -
try:
#some code that may throw an exception
except Exception as e:
#exception handling code
Run Code Online (Sandbox Code Playgroud)
两种结构的区别是什么?