re match findall research

re.match
python

import res= '23432werwre2342werwrew' p = r'(\d*)([a-zA-Z]*)'m = re.match(p,s)print(m.group()) #返回全部匹配内容 23432werwreprint(m.group(0)) #和group()同样 23432werwreprint(m.group(1)) #返回字串第一个 23432,没有字串则报错print(m.group(2)) #返回字串第二个 werwreprint(m.groups()) #返回全部字串组成的元组 ('23432', 'werwre'),若是没有字串则为空元组

ffide

相关文章
相关标签/搜索