On Wed, 05 Mar 2008 11:09:28 -0800, castironpi wrote:
> On another note, why do people X, Y, and Z, including me, all hate to
> write a= b(); if a: a.something()?
Is this a guessing game? You want us to guess why YOU hate to do
something? Okay, I'm game for guessing games...
You were traumatiz
On Mar 5, 6:12 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > if (match = re.search('(\w+)\s*(\w+)', foo)):
>
> Caveat #1: use a raw string here
> Caveat #2: inline assignment is verboten
>
> match = re.search(r'(\w+)\s*(\w*+)', foo)
> if match:
>
> > field1 = match.group(1)
> > field
Mike a écrit :
> I seem to fall into this trap (maybe my Perl background) where I want
> to simultaneously test a regular expression and then extract its match
> groups in the same action.
> For instance:
>
> if (match = re.search('(\w+)\s*(\w+)', foo)):
> field1 = match.group(1)
> field2
> if (match = re.search('(\w+)\s*(\w+)', foo)):
Caveat #1: use a raw string here
Caveat #2: inline assignment is verboten
match = re.search(r'(\w+)\s*(\w*+)', foo)
if match:
> field1 = match.group(1)
> field2 = match.group(2)
This should then work more or less. However, since y
I seem to fall into this trap (maybe my Perl background) where I want
to simultaneously test a regular expression and then extract its match
groups in the same action. For instance:
if (match = re.search('(\w+)\s*(\w+)', foo)):
field1 = match.group(1)
field2 = match.group(2)
...
(com