天天看点

Python ElementTree findall函数Bug #import xml.etree.cElementTree as etree  root.findall('country[last()]')   # 最后一个country,实际上找到了所有的country root.findall('country[last()]')   # 实际上找到了最后一个country

#import xml.etree.cElementTree as etree 

root.findall(

'country[last()]'

)  

#

最后一个country,

实际上找到了所有的

country

    from lxml import etree

root.findall(

'country[last()]'

)  

#

实际上找到了

最后一个country

    因此建议使用新的库