I have some code which relies on running each line of a file through a large number of regexes which may or may not apply. For each pattern I want to match I've been writing
gotit = mypattern.findall(line) if gotit: gotit = gotit[0] ...do whatever else... This seems kind of clunky. Is there a prettier way to handle this? I've also been assuming that using the re functions that create match objects is slower/heavier than dealing with the simple list returned by findall(). I've profiled it and these matches are the biggest part of the running time of the program, so I really would rather not use anything slower. -- http://mail.python.org/mailman/listinfo/python-list