【发布时间】:2018-03-19 03:54:57
【问题描述】:
除了finally在python中阻塞之外可以空尝试吗,像这样,
try:
#nothing here,
except:
#nothing here as well,
finally:
#nothing here too.
【问题讨论】:
-
运行你的(无意义的)代码。
-
您的块并不完全是空的——每个块都有注释。你的意思是完全空的,只包含 cmets,只包含
pass语句,还是别的什么?为什么不尝试一下,看看会发生什么? -
@RoryDaulton 解析器忽略 cmets;它们不能充当至少需要一个的语句。
标签: python python-3.x exception exception-handling