Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想打印实际的以下字符串:\n,但是我尝试的所有内容都只是将其读取为换行符。我如何打印以下内容:\n?
\n
采用
print "\\n"
或原始字符串
print r"\n"
查看有关字符串的教程。
\与另一个逃脱\。
\
你必须以\n某种方式逃脱
要么只是序列
或将整个字符串标记为原始
您需要转义反斜杠:
>>> print("\\n") \n