python爬虫如何提取br标签
展开全部
from pyquery import PyQuery as Q
html = '''
<div style="position: absolute; display: none; border-style: solid; white-space: nowrap; z-index: 9999999; transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1); background-color: rgba(50, 50, 50, 0.7); border-width: 0px; border-color: rgb(51, 51, 51); border-radius: 4px; color: rgb(255, 255, 255); font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 14px; font-family: "Microsoft YaHei"; line-height: 21px; padding: 5px; left: 620.518px; top: 173.333px;">
20170712
<br>
行业中位数:35,326
<br>
支付宝:4
<br>
</div>
'''
print Q(html).text()
html = '''
<div style="position: absolute; display: none; border-style: solid; white-space: nowrap; z-index: 9999999; transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1); background-color: rgba(50, 50, 50, 0.7); border-width: 0px; border-color: rgb(51, 51, 51); border-radius: 4px; color: rgb(255, 255, 255); font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 14px; font-family: "Microsoft YaHei"; line-height: 21px; padding: 5px; left: 620.518px; top: 173.333px;">
20170712
<br>
行业中位数:35,326
<br>
支付宝:4
<br>
</div>
'''
print Q(html).text()
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询