I\'ve checked this solution but it doesn\'t work in python3.
I\'ve an escaped string of this kind: str = \"Hello\\\\nWorld\"
and I want to obtain the sa
decode
applies to bytes
, which you can create by encoding from your string.
I would encode (using default) then decode with unicode-escape
>>> s = "Hello\\nWorld"
>>> s.encode()
b'Hello\\nWorld'
>>> s.encode().decode("unicode-escape")
'Hello\nWorld'
>>> print(s.encode().decode("unicode-escape"))
Hello
World
>>>