-1
A
回答
1
你必须转义反斜线:
\\
The backslash
(\)
character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.
此外,作为@ Torxed在他的回答中提到,可以使用前缀r
或R
:
String literals may optionally be prefixed with a letter
'r'
or'R'
; such strings are called raw strings and use different rules for interpreting backslash escape sequences.
r"Some string with \ backslash"
1
或使用:
print(r'This is \backslash')
但建议使用this \\backslash
逃逸。
相关问题
- 1. 在javascript中转义反斜杠打印两个反斜杠
- 2. 如何用Python打印反斜杠?
- 3. 获取python猎豹打印反斜杠
- 4. 如何在python中打印单个'\'(斜杠)?
- 5. 在Python中打印带反斜杠的字符串2.7
- 6. 为什么打印“\\”只打印出一个反斜杠?
- 7. 为什么打印反向引用时不打印反斜杠?
- 8. Perl |打印ASCII,但反斜杠其他
- 9. 用JavaScript中的双反斜杠替换单个反斜杠
- 10. 用Emacs中的单个反斜杠替换双反斜杠
- 11. Python rstrip反斜杠
- 12. 在php中使用双反斜杠代替单反斜杠
- 13. 用双反斜杠“\\”替换单个反斜杠“\\”
- 14. 如何用单个反斜杠替换双反斜杠
- 15. 用单个反斜杠代替双反斜杠
- 16. 在GAWK gensub仅打印一个反斜杠
- 17. 无法替换responseText中的反斜杠?
- 18. 反斜杠和正斜杠在Python中混合使用
- 19. String.replaceAll单反斜线与双反斜杠
- 20. 打印出用斜杠
- 21. js正斜杠不打印
- 22. 用Python中的字符串中的单个反斜杠替换双反斜线
- 23. 如何在Ruby中打印反斜杠的字符串
- 24. python用双反斜杠替换单反斜线
- 25. 在Python请求中转义反斜杠
- 26. 蟒蛇代替反斜杠反斜杠
- 27. Python re.split()转义反斜杠
- 28. Python反斜杠错误
- 29. Python fabric.api反斜杠地狱
- 30. 反斜杠在字符串返回两个反斜杠