[英]How to print the string “\n”
我想打印实际的以下字符串: \\n
,但是我尝试读取的所有内容都将其作为新的行运算符..我如何仅打印以下内容: \\n
?
逃离\\
另一个\\
。
print "\\n"
You have to escape \\n
somehow 您必须以某种方式逃避
\\n
Either just the sequence 只是顺序
print "\\\\n"
or mark whole string as raw 或将整个字符串标记为原始
print r"\\n"
You need to escape the backslash: 您需要转义反斜杠:
>>> print("\\n")
\n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.