我需要使用lxml或者xml.etree.ElementTree模块来解析一个XML文件。
<?xml version="1.0"?>
<corners>
<version>1.05</version>
<process>
<name>ss649</name>
<statistics>
<statistic name="Min" forparameter="modname" isextreme="no" style="tbld">
<value>0.00073</value>
<real_value>7.300e-10</real_value>
</statistic>
<statistic name="Max" forparameter="modname" isextreme="no" style="tbld">
<value>0.32420</value>
<real_value>3.242e-07</real_value>
</statistic>
<variant>
<name>Unit</name>
<value>
<value>Size</value>
<statistics>
<statistic name="Min" forparameter="modname1" isextreme="no" style="tbld">
<value>0.02090</value>
<real_value>2.090e-08</real_value>
</statistic>
<statistic name="Max" forparameter="modname2" isextreme="no" style="tbld">
<value>0.02090</value>
<real_value>2.090e-08</real_value>
</statistic>
</variant>
我需要提取所有的``值并创建一个包含这些值的字典,但我无法访问子树,应该怎么做?
试图创建一个像这样的字典:
dict={
'modname' => {
'Min' : 0.00073,
'Max': 0.32420,
}
}