How to write an XML file without header in Python?

后端 未结 7 1294
盖世英雄少女心
盖世英雄少女心 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:58

    Purists may not like to hear this, but I have found using an XML parser to generate XML to be overkill. Just generate it directly as strings. This also lets you generate files larger than you can keep in memory, which you can't do with DOM. Reading XML is another story.

提交回复
热议问题