John Machin wrote:
> Would you believe "steps 3 & 4"?
How about "two pops and a pass?"
Quick! Lower the cone of silence!
--
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net
--
http://mail.python.org/mailman/listinfo/python-list
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Mon, 15 May 2006 19:41:39 -0500, Lance Hoffmeyer
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
> > I would have something similar to perl above:
> >
> >
> > targets = ['OVERALL RATING',
> >
Would you believe "steps 3 & 4"?
--
http://mail.python.org/mailman/listinfo/python-list
Think about how well the above solutions scale as len(targets)
increases.
1. Make "targets" a set, not a list.
2. Have *ONE* regex which includes a bracketed match for a generic
target e.g. ([A-Z\s]+)
3. Do *ONE* regex search, not 1 per target
4. If successful, check if the bracketed gizmoid is in
I don't like string interpolation within REs, it pops me out of 'RE
mode' as I scan the line.
Maybe creating a dict of matchobjects could be used in the larger
context?:
dict( [(t, re.search(t+regexp_tail, file2) for t in targets] )
(untested).
- Pad.
--
http://mail.python.org/mailman/listi