例如,
except子句可以将多个异常命名为带括号的元组。
except (IDontLikeYouException, YouAreBeingMeanException) as e: pass
或者,仅对于Python 2:
except (IDontLikeYouException, YouAreBeingMeanException), e: pass
用逗号将变量与变量分开仍然可以在Python 2.6和2.7中使用,但是现在已弃用,并且在Python 3中不起作用。现在你应该使用as。

例如,
except子句可以将多个异常命名为带括号的元组。
except (IDontLikeYouException, YouAreBeingMeanException) as e: pass
或者,仅对于Python 2:
except (IDontLikeYouException, YouAreBeingMeanException), e: pass
用逗号将变量与变量分开仍然可以在Python 2.6和2.7中使用,但是现在已弃用,并且在Python 3中不起作用。现在你应该使用as。