import lxml.etree as ettree = et.fromstring('''... your xml ...''')for host_ip in tree.xpath("/scenario/init/send/command[@name='CER']/avp[@name='Host-IP-Address']"): host_ip.attrib['value'] = 'foo'print et.tostring(tree)
欢迎分享,转载请注明来源:内存溢出
import lxml.etree as ettree = et.fromstring('''... your xml ...''')for host_ip in tree.xpath("/scenario/init/send/command[@name='CER']/avp[@name='Host-IP-Address']"): host_ip.attrib['value'] = 'foo'print et.tostring(tree)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)