Python regex

Arnaud Delobelle arnodel at googlemail.com
Thu Mar 13 16:31:00 EDT 2008


On Mar 13, 8:22 pm, "Andrew Rekdal" <<nospam>@comcast.net> wrote:
[...]
> in your expression above..
>
> >>> r = re.compile(r'/\*(.*?)\*/')
>
> what does the 'r' do?

It means the literal is a 'raw string' :

>>> print 'Hi\nthere!'
Hi
there!
>>> print r'Hi\nthere!'
Hi\nthere!
>>>

If you haven't done so already, I suggest reading the tutorial.  Here
is a link to the relevant section on strings:

http://docs.python.org/tut/node5.html#SECTION005120000000000000000

--
Arnaud




More information about the Python-list mailing list