它的属性值,我有这样的XML文件读取XML文件,并获取在Python
<domain type='kmc' id='007'>
<name>virtual bug</name>
<uuid>66523dfdf555dfd</uuid>
<os>
<type arch='xintel' machine='ubuntu'>hvm</type>
<boot dev='hd'/>
<boot dev='cdrom'/>
</os>
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>270336</currentMemory>
<vcpu placement='static'>10</vcpu>
现在我想分析这个并获取其属性值。例如,我想获取uuid
字段。那么在Python中获取它的正确方法是什么?
你有什么试过的?使用Google搜索“python xml”会产生相当多的真正有用的结果,这些结果应该指向正确的方向。 – Blender
有很多例子,但没有指出我想去的方向。我想获取属性值。我看到的例子是转换为XML文件或转换形式的XML文件 –