PDA

View Full Version : Python: regular expressions


sparaig
02-09-2007, 05:38 PM
I'm completely new to Python, and don't like the tab/space thing for block control, but in the spirit of trying to learn a new language, I'm thinking of doing my Lego-block loading scriptin in Python instead of Perl. (It would also make it easier to create a Lego plugin completely in Python once I get ahold of a version of Maya later than 6.0)

How is Python as far as regular expressions go? I assume that there is some kind of module to handle all the nifty regexp features? How does it compare to Perl's handling of the same?

shufflebreaker
02-09-2007, 08:15 PM
The regular expression module is called re:

import re

I'm not sure how it compares to perl but it's well featured and fairly simple to use. You can find docs for the module here:

http://docs.python.org/lib/module-re.html

hope that helps

sparaig
02-10-2007, 08:38 PM
The regular expression module is called re:

import re

I'm not sure how it compares to perl but it's well featured and fairly simple to use. You can find docs for the module here:

http://docs.python.org/lib/module-re.html

hope that helps

Thanks. Turns out that the original OReilly _Mastering Regular Expressions_ has a section on Python and re, according to the Python FAQs. I have that book, just can't find it.

Will check your reference also.

CGTalk Moderation
02-10-2007, 08:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.