xml_Stations = ET.Element('StationInfo')
for x in G.nodes:
xml_Stations.append(rootLoc.find('./station[@name="%s"]'%x))
tree = ET.ElementTree(xml_Stations)
tree.write('output.xml', pretty_print=True, xml_declaration=True, encoding="utf-8")
xml_Stations = ET.Element('StationInfo')
for x in G.nodes:
xml_Stations.append(rootLoc.find('./station[@name="%s"]'%x))
tree = ET.ElementTree(xml_Stations)
tree.write('output.xml', pretty_print=True, xml_declaration=True, encoding="utf-8")
本文标题:Python-lxml库保存XML
本文链接:https://www.haomeiwen.com/subject/fjushctx.html
网友评论