[issue9529] Make re match object iterable

Matthew Barnett report at bugs.python.org
Fri Aug 1 13:38:46 CEST 2014


Matthew Barnett added the comment:

Match objects have a .groups method:

>>> import re
>>> m = re.match(r'(\w+):(\w+)', 'qwerty:asdfgh')
>>> m.groups()
('qwerty', 'asdfgh')
>>> k, v = m.groups()
>>> k
'qwerty'
>>> v
'asdfgh'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9529>
_______________________________________


More information about the Python-bugs-list mailing list