How to write an XML file without header in Python?

后端 未结 7 1293
盖世英雄少女心
盖世英雄少女心 2021-02-06 01:28

when using Python\'s stock XML tools such as xml.dom.minidom for XML writing, a file would always start off like

<

7条回答
  •  遥遥无期
    2021-02-06 01:57

    Just replace the first line with blank:

    import xml.dom.minidom as MD     
    .replace(MD.Document().toxml()+'\n', '') 
    

提交回复
热议问题