Raw String Question
MRAB
google at mrabarnett.plus.com
Thu Mar 12 20:58:35 EDT 2009
andrew cooke wrote:
> MRAB wrote:
> [...]
>> The other special case is with \u in a Unicode string:
>>
>> >>> ur"\u0041"
>> u'A'
>
> this isn't true for 3.0:
>
>>>> r"\u0041"
> '\\u0041'
>
> (there's no "u" because it's a string, not a bytes literal)
>
> and as far as i can tell, that's correct behaviour according to the docs.
>
From the 3.0 docs "Even in a raw string, string quotes can be escaped
with a backslash, but the backslash remains in the string". Seems a bit
pointless to me. I would've preferred the backslash to have no special
behaviour at all. Simpler, IMHO...
More information about the Python-list
mailing list