Duncan Booth wrote:
If you are getting input from the user, then unless you are doing some processing on it to interpret escape sequences the chances are you already have what you need to use as a regular expression. If you *are* interpreting escape sequences then the answer is you need to not do that since the operation isn't really reversible.

If you are interpreting escape sequences, you probably want string.decode or string.encode:


>>> '\\n\\r'.decode('string_escape')
'\n\r'
>>> '\n\r'.encode('string_escape')
'\\n\\r'

Steve
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to