Xpath extract current node content including all child node
问题 I've met a problem while extracting current node content including all child node. Just like the following code, I want to get string abcdefg<b>b1b2b3</b> in pre tag. But I could not use "child::*" to get it. If I use "/text()", I lost b tag format information. Please help me out. # -*- coding: utf-8 -*- from lxml import html import lxml.etree as le input = "<pre>abcdefg<b>b1b2b3</b></pre>" input_xpath = "//pre/child::*" tree = html.fromstring(input) result = tree.xpath(input_xpath) result1 =