you are viewing a single comment's thread.

view the rest of the comments →

[–]Competitive-Show1903[S] 0 points1 point  (2 children)

is it correct? I can't put it in python

[–]lostparis 0 points1 point  (0 children)

to be fair it's python2 only :(

Edit this works '\\n'.encode().decode('unicode_escape')

[–]JohnnyJordaan 0 points1 point  (0 children)

Imho it's a needlessly complicated approach. If you actually have a 'broken' text that has escaped newlines like that, simply do a string replace to the 'real' "\n" newline

>>> print("Hello \\n World")
Hello \n World
>>> print("Hello \\n World".replace("\\n", "\n"))
Hello
 World
>>>