相关疑难解决方法(0)

为什么我不能用反斜杠结束原始字符串?

我在这里很困惑,即使原始字符串转换为每个\,\\但\最后它出现时会引发错误.

>>> r'so\m\e \te\xt'
'so\\m\\e \\te\\xt'

>>> r'so\m\e \te\xt\'
SyntaxError: EOL while scanning string literal
Run Code Online (Sandbox Code Playgroud)

更新:

现在也在Python常见问题解答中介绍:为什么原始字符串(r-strings)不能以反斜杠结尾?

python string rawstring

8
推荐指数
3
解决办法
3424
查看次数

标签 统计

python ×1

rawstring ×1

string ×1