Escaping certain characters

Jan Danielsson jan.danielsson at gmail.com
Sat Jul 30 20:11:28 EDT 2005


Robert Kern wrote:
[---]
> In [3]: s.encode('string_escape')
> Out[3]: 'Hello\\nWorld!'
> 
> In [4]: Out[3].decode('string_escape')
> Out[4]: 'Hello\nWorld!'
> 
> Not *quite* what you asked for, but it ought to be close enough.

That'll do just fine. Many thanks!



More information about the Python-list mailing list