RFC PEP candidate: q'<delim>'quoted<delim> ?
Greg Ewing
greg at cosc.canterbury.ac.nz
Sun Mar 10 22:31:45 EST 2002
Bengt Richter wrote:
>
> Would someone explain this:
>
> >>> eval("list(r'\x07')")
> ['\x07']
> >>> list(r'\x07')
> ['\\', 'x', '0', '7']
The string literal you're passing to eval is
non-raw, so the \x07 gets interpreted before
eval even sees it. Try this instead:
>>> eval(r"list(r'\x07')")
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list