37,719
社区成员
发帖
与我相关
我的任务
分享
txt="""
<div class="gnzzp"><p class="zz"><a href="/zhuzhi/" target="_blank">【功能主治】</a><a class="zyzz" target="_blank" href="/zhuzhi/qufeng.html" title="中药主治:祛风">祛风</a><a target="_blank" href="/zhuzhi/chushi.html" title="中药主治:除湿">除湿</a>;<a target="_blank" href="/zhuzhi/wenzhong.html" title="中药主治:温中">温中</a><a class="zyzz" target="_blank" href="/zhuzhi/zhixie-2.html" title="中药主治:止泻">止泻</a>;<a class="zyzz" target="_blank" href="/zhuzhi/huoxuejiedu.html" title="中药主治:活血解毒">活血解毒</a>。主<a class="zyzz" target="_blank" href="/zhuzhi/fenghanganmao.html" title="中药主治:风寒感冒">风寒感冒</a>;<a class="zyzz" target="_blank" href="/zhuzhi/toufengtoutong.html" title="中药主治:头风头痛">头风头痛</a>;<a class="zyzz" target="_blank" href="/zhuzhi/fengshibitong.html" title="中药主治:风湿痹痛">风湿痹痛</a>;寒湿泻<a class="zyzz" target="_blank" href="/zhuzhi/li.html" title="中药主治:痢">痢</a>;寸白虫病;<a class="zyzz" target="_blank" href="/zhuzhi/dusheyaoshang.html" title="中药主治:毒蛇咬伤">毒蛇咬伤</a>;<a class="zyzz" target="_blank" href="/zhuzhi/diedashangtong.html" title="中药主治:跌打伤痛">跌打伤痛</a>;<a target="_blank" href="/zhuzhi/xuan.html" title="中药主治:癣">癣</a><a class="zyzz" target="_blank" href="/zhuzhi/chuang.html" title="中药主治:疮">疮</a></p></div><!--div gnzz end--><div class="gnzz-more"><script type="text/javascript" src="/all/gnzz-m.js"></script></div><p>【用法用量】内服:煎汤,10-15g,鲜品加倍。外用:适量,煎水洗;或捣敷。</p><p>【注意】阴虚血热者慎用。</p><p>【附方】<a target="_blank"
"""
import re
#取出【功能主治】~句号
patt=re.compile(r'【功能主治】</a>(.*?)。',re.S)
#取出非html标签内容
patt2=re.compile(r'.*?>(.*?)<.*?',re.S)
zzr=patt.findall(txt)
for item in zzr:
zz=patt2.findall(item)
print(''.join(zz))#祛风除湿;温中止泻;活血解毒
#print(zzr)