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
Could you clarify this question?
line = "Cats are smarter than dogs"
matchObj = re.match( r'(.*) are (.*?) .*', line, re.M|re.I)
print "matchObj.group() : ", matchObj.group()
print "matchObj.group(1) : ", matchObj.group(1)
print "matchObj.group(2) : ", matchObj.group(2)
print "No match!!"