Message245362
You can use mo.groupdict().
print('Located coordinate at (%(row)s, %(col)s)' % mo.groupdict())
print('Located coordinate at ({row}, {col})'.format_map(mo.groupdict()))
As for len(mo), this is ambiguous, as well as indexing with integer indices. You suggest len(mo) be equal len(mo.groups()) and this looks reasonable to me, but in regex len(mo) equals to len(mo.groups())+1 (because mo[1] equals to mo.group(1) or mo.groups()[0]). If indexing will work only with named groups, it would be expected that len(mo) will be equal to len(mo.groupdict()). |
|
Date |
User |
Action |
Args |
2015-06-15 04:29:28 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, ezio.melotti, mrabarnett |
2015-06-15 04:29:28 | serhiy.storchaka | set | messageid: <1434342568.32.0.199956771478.issue24454@psf.upfronthosting.co.za> |
2015-06-15 04:29:28 | serhiy.storchaka | link | issue24454 messages |
2015-06-15 04:29:27 | serhiy.storchaka | create | |
|