Newbie question - what is the 'r' operator?

Craig Findlay craigf at ilid.com.au
Tue Feb 8 22:53:12 EST 2000


Thanks to Fredrik and Thomas for your help :)

Craig

"Fredrik Lundh" <effbot at telia.com> wrote:

>Craig Findlay <craigf at ilid.com.au> wrote:
>> This is probably obvious but ...
>>
>> I have seen example code where an 'r' prefix is used in from of a
>> string, eg r'mystring'
>>
>> What does it do, I can't seem to locate any documentation about it.
>
>    http://www.python.org/doc/current/ref/strings.html
>
>    "When an 'r' or 'R' prefix is present, backslashes
>    are still used to quote the following character,
>    but all backslashes are left in the string."
>
>(useful when embedding all sorts of cryptic sublanguages in
>python strings, such as regular expressions or windows file
>names...)
>
></F>
>




More information about the Python-list mailing list