xml.etree.ElementTree的问题

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

xml.etree.ElementTree的问题

cafeeee
我在使用xml.etree.ElementTree的时候碰到一个问题,代码如下:

tree = ElementTree.ElementTree("one.xml")
tree.write("two.xml", "utf_8")

按照我的预期,two.xml应该和one.xml一样,结果发现,one.xml中的所有由<!--、-->括起来的注释在two.xml中都没有了,请问有什么办法可以保留那些注释吗?
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese