wrapped around the axle on regexpressions and file searching

Terry Reedy tjreedy at udel.edu
Sat Apr 24 21:58:48 EDT 1999


[code to find and process files ending in .log]

>2. is there a better, faster way of doing this??, 

For matching literal text, string.find, .rfind, .index, .rindex
are faster that regexes.  Since you want to match text at end only,
  if filename[-4:] == '.log'
will be even faster.

TJR





More information about the Python-list mailing list