我想用ElementTree解析一个XML文件,但是在某个标记处输出是错误的
<descriptions>
<description descriptionType="Abstract">Some Abstract Text
</description>
</descriptions>
所以我用XML函数来解析它
import xml.etree.ElementTree as ElementTree
root = ElementTree.XML(my_xml)
root.getchildren()[0].items()
结果是:
Out: [('descriptionType', 'Abstract')]
XML有什么问题吗?我用错了ElementTree,还是它有问题?你知道吗
我猜你想得到文本。所以:
不是
只是如果没有标签,它就存储在文本属性中。。你知道吗
相关问题 更多 >
编程相关推荐