Alexander Q. wrote:
My question is how does Python know to return just the part in the
parentheses and not to return the "blahblah" and the "yattayattayatta",
etc...? The 're.search' function returns the whole thing, and if I want
just the parentheses parts, I do tuples.group(1) or tuples.group(
On Tue, Jul 10, 2012 at 9:26 PM, Alexander Q. wrote:
> I'm a bit confused about extracting data using re.search or re.findall.
>
> Say I have the following code: tuples =
> re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over',
> text)
>
> So I'm looking for that string in 'tex
I'm a bit confused about extracting data using re.search or re.findall.
Say I have the following code: tuples =
re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over',
text)
So I'm looking for that string in 'text', and I intend to extract the parts
which have parentheses around