[EMAIL PROTECTED] writes: > Here's a small session > >>>> import re >>>> p=re.compile('[a-z]+') >>>> m=p.match('abb1a') >>>> dir(m) > ['__copy__', '__deepcopy__', 'end', 'expand', 'group', 'groupdict', > 'groups', 'span', 'start'] >>>> help(m.groups) > Help on built-in function groups: > > groups(...) > >>>> > > My question is. How do I interpret the hiven help info > groups(...) > > alt1. Tough luck. There's no help. People are to busy to write > reference manuals. > alt 2. There are no parameters. The only possibility is m.groups() > alt3. Something else
alt 3, specifically: No doc string, time to check the reference manual. <URL: http://docs.python.org/lib/match-objects.html > says: groups( [default]) Return a tuple containing all the subgroups of the match, from 1 up to however many groups are in the pattern. The default argument is used for groups that did not participate in the match; it defaults to None. (Incompatibility note: in the original Python 1.5 release, if the tuple was one element long, a string would be returned instead. In later versions (from 1.5.1 on), a singleton tuple is returned in such cases.) Since you don't have any groups in your re, groups is always going to return (). You probably want group(). <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list