xmltodict 像处理JSON处理XML
xmltodict简介
xmltodict,Python第三方库,可以使处理XML感觉就像处理JSON一样。
xmltodict应用实例
>>> print(json.dumps(xmltodict.parse("""
... <mydocument has="an attribute">
... <and>
... <many>elements</many>
... <many>more elements</many>
... </and>
... <plus a="complex">
... element as well
... </plus>
... </mydocument>
... """), indent=4))
{
"mydocument": {
"@has": "an attribute",
"and": {
"many": [
"elements",
"more elements"
]
},
"plus": {
"@a": "complex",
"#text": "element as well"
}
}
}
xmltodict Github统计数据
MIT license
Github 5.3k stars
xmltodict安装命令
pip install xmltodict
xmltodict文档
Github:xmltodict
免责声明:内容编辑自网络,仅供参考,不保证正确性,不作任何决策依据!!以上数据皆截止于博文的写稿日期。