我正在尝试使用 .xml 提取 XML 文档的两个标签之间的文本值xml.etree.ElementTree
。在以下示例中,这将是值text two
和text three
。我只能提取text one
. 我如何从<c>
标签中找到其他文本?
import xml.etree.ElementTree as ET
root = ET.fromstring(
"<foo><c>text one<sub>ttt</sub>text two<sub>uuu</sub>text three</c></foo>")
print root[0].text # text one