Python 3:
"hurr..\n..durr".encode('unicode-escape').decode()
Python 2:
"hurr..\n..durr".encode('string-escape')
Еще один способ:
>>> s = "hurr..\n..durr" >>> print repr(s).strip("'") hurr..\n..durr