没啥难的遇到了就记一下,万一以后想不起来 cont = 'xxx' html = etree.HTML(cont) # xpath匹配想要的内容 element_ = html.xpath('//div[@class="paragraphs medium"]/p[1]')[0] # 是个element对象 # 最后如果不转码会是个 bytes 类型数据 string = etree.tostring(element_, encoding='utf-8').decode('utf-8') # 字符串类型