【发布时间】:2018-02-24 01:32:39
【问题描述】:
简而言之,来自 Python
一个try/except/finally语句,如:
try: ...guarded clause... except ...expression...: ...exception handler code... finally: ...clean-up code...相当于嵌套语句:
try: try: ...guarded clause... except ...expression...: ...exception handler code... finally: ...clean-up code...
- 为什么它等同于嵌套表单?
-
可以写成没有
finally的形式吗?是否等价于
try: ...guarded clause... except ...expression...: ...exception handler code... ...clean-up code... ...clean-up code...
谢谢。
【问题讨论】:
标签: python python-3.x exception-handling try-catch programming-languages