擅长:python、mysql、java
<p>反斜杠<code>\</code>是错误消息所指的行继续符,在它之后,只允许换行符/空白(在下一个非空白继续“中断”行之前)。</p>
<pre><code>print "This is a very long string that doesn't fit" + \
"on a single line"
</code></pre>
<p>在字符串外部,反斜杠只能以这种方式出现。对于除法,需要斜线:<code>/</code>。</p>
<p>如果要在字符串中写入逐字反斜杠,请将其加倍以进行转义:<code>"\\"</code></p>
<p>在你的代码中,你使用了两次:</p>
<pre><code> print("Length between sides: " + str((length*length)*2.6) +
" \ 1.5 = " + # inside a string; treated as literal
str(((length*length)*2.6)\1.5)+ # outside a string, treated as line cont
# character, but no newline follows -> Fail
" Units")
</code></pre>