[Tutor] advice on idiomatic python and re module question
fant at pobox.com
Mon May 17 17:55:31 EDT 2004
I had a feeling I was doing something stupid like calling the wrong method.
that will learn me to try and be more clever than I am. Either that or to
not think in Fortran.
--On Monday, May 17, 2004 14:38:00 -0600 Bob Gailer <bgailer at alum.rpi.edu>
> At 12:34 PM 5/17/2004, Andrew Fant wrote:
>> First, I cannot seem to compile and use more than one regexp in a
> You can have as many regexps as you like.
>> if I use:
>> to define the patterns, I can use:
>> if pattern1.match(line):
>> to check for a comment line succesfully,but
>> if pattern2.match(line):
> Note that match starts at the beginning of the line. Hence (1) the ^ is
> superfluous and (2) 'eth0' must be at the beginning of the line to match.
> If 'eth0' is not at the beginning, the pattern should be '.*eth0'. Or you
> could use search instead of match, which looks thru the line for the
> Bob Gailer
> bgailer at alum.rpi.edu
> 303 442 2625 home
> 720 938 2625 cell
More information about the Tutor