PyDocs

Nav

Text Processing Services

Match.groupdict

re

method of Match
  • Match.groupdict(default=None)
Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.

default
  Is used for groups that did not participate in the match.
1 Example
>>> m = re.search(r"(?P<adjective>\w+) (?P<animal>\w+)", "killer rabbit")
>>> m.groupdict()
{'adjective': 'killer', 'animal': 'rabbit'}
from the Python docs
See Also
No see-alsos for re/Match.groupdict
0 Notes
No notes for Match.groupdict