且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在将新元素插入现有xml中时,lxml不添加换行符

更新时间:2023-11-07 12:55:28

这可能对您来说很有趣.

This might be of intrest to you.

http: //lxml.de/FAQ.html#why-doesn-t-the-pretty-print-option-reformat-my-xml-output

简而言之,供以后参考:

In short for future reference:

parser = etree.XMLParser(remove_blank_text=True)
pom = etree.parse("pom.xml",parser)