我有一个XML字符串,我想修改特定接口的模型类型。需要帮助来修改与python xml
<domain type='kvm'>
<devices>
<interface type='network'>
<mac address='52:54:00:a8:fe:3d'/>
<source network='ovirtmgmt'/>
<model type='virtio'/>
</interface>
<interface type='network'>
<mac address='52:54:00:a8:fe:7d'/>
<source network='nat'/>
<model type='virtio'/>
</interface>
<interface type='network'>
<mac address='52:80:00:a8:66:20'/>
<source network='vm'/>
<model type='virtio'/>
</interface>
</devices>
</domain>
现在,我要换模型type='e1000'
其中source network='nat'
。我怎样才能做到这一点?
敢肯定你能找到eveythin你所需要的'https://开头docs.python.org/3 /库/ xml.etree.elementtree.html' –
[LXML] (http://lxml.de/)是另一个最爱。 – wwii