J
JH
Hi
I am a fussy learner. Could someone explain to me why the following
inconsistency exists between methods? How can it be justified if it is
considered all right?
There are three groups in pattern. However, match object shows 3 groups
in collection, but group has to be indexed from one because the
m.group(0) is the implicit group for whole pattern.
Are these just some things to remember? "Group counting is from one".
Traceback (most recent call last):
File "<pyshell#279>", line 1, in -toplevel-
m.group(4)
IndexError: no such group
I am a fussy learner. Could someone explain to me why the following
inconsistency exists between methods? How can it be justified if it is
considered all right?
There are three groups in pattern. However, match object shows 3 groups
in collection, but group has to be indexed from one because the
m.group(0) is the implicit group for whole pattern.
Are these just some things to remember? "Group counting is from one".
Traceback (most recent call last):
File "<pyshell#279>", line 1, in -toplevel-
m.group(4)
IndexError: no such group
p.findall(s) [('???', '?', 'ef')]