Python-lxml库保存XML

2019-07-05  本文已影响0人  微雨旧时歌丶
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")
上一篇 下一篇

猜你喜欢

热点阅读