Best way to extract from regex in if statement
Tim Chase
python.list at tim.thechases.com
Fri Apr 3 22:32:55 EDT 2009
> Or in case you want to handle each regexp differently, you can
> construct a dict {regexp : callback_function} that picks the right
> action depending on which regexp matched.
One word of caution: dicts are unsorted, so if more than one
regexp can match a given line, they either need to map to the
same function, or you need to use a list of regexp-to-functions
(see my previous post) for a determinate order.
-tkc
More information about the Python-list
mailing list