python使用findall正则匹配出所有符合条件的字符串
# -*- coding:utf-8 -*- import re mystr="qqq key:www.baidu.com<br>key:www.tengxun.com<br>" pattern = re.compile(r'key:(.*?)<br>') result = pattern.findall(mystr) print(result)
输出结果:
['www.baidu.com', 'www.tengxun.com']