![](/img/trans.png)
[英]Is there a difference between “raise exception()” and “raise exception” without parenthesis?
[英]Difference between raise Exception, “foo” and raise Exception(“foo”)?
標題是非常自我解釋 - 有什么區別:
raise Exception, "foo"
和
raise Exception("foo")
它是否完全相同,只是不同的語法?
我正在使用Python 2.x,但我想知道Python 3.x中的任何差異
兩者在Python2中都是相同的。 在Python3中,不再支持raise Exception, "foo"
語法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.