On 2014-07-06 19:26, rxjw...@gmail.com wrote:

I cannot get the difference between matchObj.group() and matchObj.group(0),
Although there definitions are obvious different. And group() mentions 'tuple'.
tuple means all the elements in line object?

Match Object Methods


group(num=0) This method returns entire match (or specific subgroup num)
groups()     This method returns all matching subgroups in a tuple
              (empty if there weren't any)

I run the following code. Even I add more words to line object, Both have the
same output.

Could you clarify this question?

matchObj.group(g) returns what was captured by group g.

If you don't specify the group, it'll assume that you want group 0,
which is the entire part of the string that matched.


Reply via email to