我看不到以下兩行之間的顯着差異。Python錯誤 - 或者我的愚蠢 - 當掃描字符串文字時EOL
然而,第一個解析,而後者,並沒有。
In [5]: n=""" \\"Axis of Awesome\\" """
In [6]: n="""\\"Axis of Awesome\\""""
File "<ipython-input-6-d691e511a27b>", line 1
n="""\\"Axis of Awesome\\""""
^
SyntaxError: EOL while scanning string literal
這是一個Python的bug /功能/古怪,或者我錯過了一些基本的東西?
只要使用' '''的',而不是' 「」「' –
' \\'不會脫離引號,因爲它是一個反斜槓。 – katrielalex