On Fri, April 7, 2006 8:23 pm, Carlos Benevides wrote:
> Hi,
>
> Can someone tell me what the r before the expression means, as in
> "re.compile(r'(\.exe|\.zip|\.pif|\.scr|\.ps|\.pdf|\.ppt)$')"?

r is the way of making a string "raw". This means that escape characters
will not be interpreted. Here is an example that should make it clear.

>>> foo = "This is \t me"
>>> print foo
This is          me
>>> foo = r"This is \t me"
>>> print foo
This is \t me
>>>

Since slashes are used often for writing regexps, it's useful to make the
strings raw.

Peace.

-- 
-NI

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to