How to store ASCII encoded python string?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Mon Aug 28 16:00:52 EDT 2006
In <1156792022.792854.90700 at i42g2000cwa.googlegroups.com>, micahc wrote:
> So, how do I store "\tsome text\xa7 some more text\n" as that instead
> of:
> " some text§ some more text
> "
>
> I don't have a problem escaping it so the above would look like
> "\\tsome text\\xa7 some more text\\n" as long as I have a way to later
> unescape it when I want to actual do something with the data.
In [6]: '\tsome text\xa7some more text\n'.encode('string_escape')
Out[6]: '\\tsome text\\xa7some more text\\n'
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list