This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Phillip.M.Feldman@gmail.com
Recipients Phillip.M.Feldman@gmail.com, ash
Date 2009-08-07.19:46:17
SpamBayes Score 1.1455281e-12
Marked as misclassified No
Message-id <4A7C8477.2060302@verizon.net>
In-reply-to <1249647816.27.0.870888494795.issue6663@psf.upfronthosting.co.za>
Content
You are right-- the documentation does say this, although it took me a 
while to understand what it means.  Thanks!

It seems as though there's a flaw in the design here, because there 
should be some mechanism for grouping elements of a regular expression 
without having findall treat these as groups for purposes of packaging 
the output.  If someone really wants to get lists of tuples out of 
findall, then it might make sense to input a tuple of strings instead of 
a single string.

Phillip

Alexey Shamrin wrote:
> Alexey Shamrin <shamrin@gmail.com> added the comment:
>
> You've made three groups with parentheses. Just drop them:
>
>   
>>>> re.findall('-?\d+[.]\d+|-?\d+[.]?|-?[.]\d+', 'asdf6.7jjjj7.33ff9')
>>>>         
> ['6.7', '7.33', '9']
>
> Everything is according to documentation: "If one or more groups are
> present in the pattern, return a list of groups; this will be a list of
> tuples if the pattern has more than one group."
>
> http://docs.python.org/library/re.html#re.findall
>
> I would suggest to close this bug.
>
> ----------
> nosy: +ash
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue6663>
> _______________________________________
>
>
History
Date User Action Args
2009-08-07 19:46:19Phillip.M.Feldman@gmail.comsetrecipients: + Phillip.M.Feldman@gmail.com, ash
2009-08-07 19:46:18Phillip.M.Feldman@gmail.comlinkissue6663 messages
2009-08-07 19:46:17Phillip.M.Feldman@gmail.comcreate