# -*- 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']