Python
python展开代码import json
import xmltodict
d = xmltodict.parse("""
   <mydocument has="an attribute">
     <and>
       <many>elements</many>
       <many>more elements</many>
     </and>
     <plus a="complex">
       element as well
     </plus>
   </mydocument>
""")
print(json.dumps(d, indent=4))
xml_res = xmltodict.unparse(d, pretty=True)
print(xml_res)


本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!