关于python的正则表达式问题
我想通过正则表达式匹配的同时可以获取到相应的值,该怎么搞呢
比如:
s='asa02cid=333fsdf'
pattern=re.compile('.*cid=.*')
我想获得333
[解决办法]
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more information.>>> import re>>> s='asa02cid=333fsdf'>>> m = re.search('=(\d+)', s)>>> if m: print m.groups() ('333',)>>>