Parsing strings?

Neil Schemenauer nas-usenet at
Mon Apr 14 17:15:32 CEST 2003

Michael Hudson <mwh at> wrote:
> tweedgeezer at (Jeremy Fincher) writes:
>> Is there any way to turn a string (in Python format, escapes and all)
>> into an actual Python string without using eval()?
>> I.e., I'd like to turn the four-character string "\\x00" into the
>> one-character Python string "\x00" without using eval().  Is there any
>> way to do that?

In Python 2.3 courtesy of MvL:

    >>> '\\x00'.decode('string-escape')

> Don't think so -- and if there is, Lib/compiler/ would
> like to know...

I guess someone should tell it.


More information about the Python-list mailing list