擅长:python、mysql、java
<p>这是因为<code>\</code>ecaps了<code>"</code>,而python在字符串中没有找到任何右引号,因此它引发了<code>EOL</code>错误:</p>
<pre><code>In [19]: "This the newbie\ " #add a space after `\` and it works
Out[19]: 'This the newbie\\ '
In [20]: "This the newbie\"
File "<ipython console>", line 1
"This the newbie\"
^
SyntaxError: EOL while scanning string literal
In [22]: "\"This the newbie\""
Out[22]: '"This the newbie"'
</code></pre>