Newbie question - what is the 'r' operator?

Emile van Sebille emile at fenx.com
Wed Feb 9 22:04:19 EST 2000


Just remember you can't end with a single back-slash.

--

Emile van Sebille
emile at fenx.com
-------------------


Craig Findlay <craigf at ilid.com.au> wrote in message
news:93p1as04hd739si7v44dbdqio6tmevfs1n at 4ax.com...
> 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>
> >
>
> --
> http://www.python.org/mailman/listinfo/python-list
>







More information about the Python-list mailing list