Escape chars in string
Jeff Epler
jepler at unpythonic.net
Mon Nov 8 15:44:07 EST 2004
Python 2.3 has a 'string-escape' codec. If you have a string like '\\t'
(a literal backslash followed by a t) and want to turn it into the
string '\t' (a tab character), you can use it for that purpose:
>>> r"a\tb".decode("string-escape")
'a\tb'
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20041108/fcd32c13/attachment.sig>
More information about the Python-list
mailing list