本帖最后由 c755731262 于 2015-11-13 06:34 编辑
| import re | | m=re.match(r'(\w+) (\w+)(?P<sign>.*)','hello world!') | | print 'm.string:',m.string | | print 'm.re: ',m.re | | print 'm.pos: ',m.pos | | print 'm.endpos: ',m.endpos | | print 'm.lastindex: ',m.lastindex | | print 'm.lastgroup: ',m.lastgroup | | print 'm.group(1,2): ',m.group(1,2) | | print 'm.groups(): ',m.groups() | | print 'm.groupdict(): ',m.groupdict() | | print 'm.start(1): ',m.start(1) | | print 'm.end(1): ',m.end(1) | | print 'm.span(1): ',m.span(1) | | COPY |
|