2013年12月6日

python ElementTree 输出带缩进格式的xml string

摘要: 在使用xml.etree.ElementTree将xml内容作为一个字符串输出时,模块提供的tostring函数直接将xml内容输出为一整行字符串,没有对不同节点进行分行缩进显示的功能。考虑如下的示例:1 import xml.etree.ElementTree as ET2 3 root_node... 阅读全文

posted @ 2013-12-06 21:37 vanilla_sky 阅读(8816) 评论(1) 推荐(3)

导航