Escaping certain characters

Jan Danielsson jan.danielsson at gmail.com
Sat Jul 30 19:44:22 EDT 2005


Hello,

I'd like to encode the string that outputs:

Hello
World!

to 'Hello\x0aWorld!', and the string that outputs:

Hello\World!

to 'Hello\\World!'.

Obviously, I want to be able to reverse the process.

I'm going to assume this has already been solved in Python.. But how?



More information about the Python-list mailing list