For example, I have a list
l = ['\n']
conversion to str
s = str(l)
it's output
['\n']
I want to print a linefeed. What should I do.
I try to remove '['
and "'"
print(s.replace('[','').replace(']','').replace("'",""))
It's have no effect.
Solve. when list to str,It's Why print
\n
.instead of linefeed. beacause it not conversion a linefeed,but a\\n
character.so,just use\n
replace\\n
.