它的屬性值,我有這樣的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文件 –