[FRPythoneers] OK, next question - Regular expressions

J. Wayde Allen wallen at lug.boulder.co.us
Tue May 1 14:02:06 MDT 2001

Yes, well ... as you've probably figured out I'm kind of new to Python,
and I'm not too sure I understand the way that Python handles regular
expressions.  What actually happens when one "compiles" a regular

If I want to extract lines from a file that begin with numerical data for
instance would I do something like:

    pattern = regex.compile('^[0-9]']

    for line in open(filename, 'r').readlines():
       if pattern.match(line):
          print line

- Wayde
  (wallen at lug.boulder.co.us)

More information about the FRPythoneers mailing list