请问如何提取br标签内的数据
通过etree对象提取br标签内的数据返回值为空
<div class="msg">
<br>
日期 数据1 数据2
<br>
2022-06-28 3.4 3.5
<br>
</div>
from lxml import etree
host_list = tree.xpath('//*[@class="msg"]/br')
for host in host_list:
res_text = host.xpath('./br/text()')
标签内没有数据 .... The
<br>
tag is an empty tag which means that it has no end tag.host.tail
获取br
後面的数据, 而不是它本身的数据.