使用查找元素xml.etree.ElementTree文件[新手]

2024-06-06 03:01:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在分析这个文件:https://www.crossref.org/xml-samples/article_with_references.xml,看起来我不明白https://docs.python.org/2/library/xml.etree.elementtree.html

如果

for child in root.getchildren():
    print(child.tag)

结果包括:

{schema}head
{schema}body

原因:

root.find('head')

没有结果?你知道吗

我真的需要写信吗

root.find('{schema}head')

或者有没有办法避免重复{schema}和简单地写head?你知道吗


Tags: 文件httpsorgchildschemawwwwitharticle