re
module
group
Returns group by the number.
m = re.match(r"(\w+).(\d+)", "www.222")
m.group(1) # 'www'
m.group(2) # '222'
groups
Returns a tuple of groups found.
m = re.match(r"(\w+).(\d+)", "www.222") # gives matches
m.groups() # ('www', '222')
groupdict
Returns a dictionary of named groups.
m = re.match(r"(?P<words>\w+).(?P<numbers>\d+)", "www.222")
m.groupdict()
# {'word': 'www', 'number': '222'}