代码 tree = etree.HTML(resp.text) elem = tree.xpath('//div[@class="post_body"]')[0] need_html = etree.tostring(elem).decode('UTF-8')