📜  python将不可打印字符转义字符串 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:38.067000             🧑  作者: Mango

代码示例1
text_to_print = repr(text_with_newlines_and_other_things)
print(text_to_print)

# example
>>> print("hi\nthere")
hi
there
>>> print(repr("hi\nthere")) 
'hi\nthere'