RFC PEP candidate: q'<delim>'quoted<delim> ?
Bengt Richter
bokr at oz.net
Sun Mar 10 22:58:38 EST 2002
On Mon, 11 Mar 2002 16:31:45 +1300, Greg Ewing <greg at cosc.canterbury.ac.nz> wrote:
>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')")
>
Aaugh, touché & d'oh. That's embarrassing ;-/
Regards,
Bengt Richter
More information about the Python-list
mailing list