我在这里很困惑,即使原始字符串转换为每个\,\\但\最后它出现时会引发错误.
\
\\
>>> r'so\m\e \te\xt' 'so\\m\\e \\te\\xt' >>> r'so\m\e \te\xt\' SyntaxError: EOL while scanning string literal
更新:
现在也在Python常见问题解答中介绍:为什么原始字符串(r-strings)不能以反斜杠结尾?
python string rawstring
python ×1
rawstring ×1
string ×1