# coding: utf-8
import json
import re
import os
import string
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
s_txt = '<a href="http://www.baidu.com">baidu</a>\n<a href="http://www.google.com">google</a>'
re_str = '\<a href=\"(.*?)\"\>(.*?)\<\/a\>'
re_pat = re.compile(re_str)
search_ret = re_pat.findall(s_txt)
print search_ret
python 非贪婪多匹配,注意使用findall
最新推荐文章于 2022-07-04 00:07:34 发布