>>> try:只能如下:
... raise "trying"
... except "trying":
... print "catch it"
... finally:
File "", line 5
finally:
^
SyntaxError: invalid syntax
>>> try:
... try:
... raise "trying"
... finally:
... print "finally"
... except "trying":
... print "catch it"
...
finally
catch it
1 条评论:
从 Python 2.5 开始支持 try/except/finally 语法!
发表评论