matching multiple regexs to a single line...

Alexander Sendzimir lists at battleface.com
Tue Nov 12 16:35:18 EST 2002


John,

Thanks for your response. This is what I was afraid of. This seems really
sloppy. You don't think there is any better way of doing such a thing? In
the mean time, what you propose is exactly what I've been doing. Hmmmm.

Alex



On Tue, 12 Nov 2002 15:18:01 +0000, John Hunter wrote:
> 
> That's what I usually end up doing
> 
> for line in myfile:
>   m = r1.match(line)
>   if m:
>     do_something()
>     break
> 
>   m = r2.match(line)
>   if m:
>     do_something_else()
>     break
>   
> 
> John Hunter




More information about the Python-list mailing list