Message245362
| Author |
serhiy.storchaka |
| Recipients |
ezio.melotti, mrabarnett, rhettinger, serhiy.storchaka |
| Date |
2015年06月15日.04:29:27 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1434342568.32.0.199956771478.issue24454@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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()). |
|
History
|
|---|
| 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 |
|