【exception keynote】
Note that the parentheses around this tuple are required, because except ValueError, e:
was the syntax used for what is normally written as except ValueError as e:
in modern Python (described below). The old syntax is still supported for backwards compatibility.
This means exceptRuntimeError, TypeError
is not equivalent to except (RuntimeError, TypeError):
but to except RuntimeError as TypeError:
which is not what you want.
参考:https://docs.python.org/2.7/tutorial/errors.html#exceptions