tree = etree.HTML(html) tag = tree.xpath('//~~')[0] text_tag = tag.xpath('string(.)').strip() #只有这个方法最可靠
tree = etree.HTML(html) node_list = tree.xpath('//div[contains(@id, "qiushi_tag")]') #id属性中包含'qiushi_tag' #<div class="article block untagged mb15 typs_long" id="qiushi_tag_120321510">
浙公网安备 33010602011771号