python dict转xml
来源:互联网 发布:阿里云 搭建vpn 编辑:程序博客网 时间:2024/06/07 06:06
原文链接: python dict转xml
代码
import dicttoxmlfrom xml.dom.minidom import parseStringd = {'k':[{'k1':'v1'}, {'k2':'v2', 'k3':'v3'}]}xml = dicttoxml.dicttoxml(d, attr_type=False, root=False)print(xml)dom = parseString(xml)xml = dom.toprettyxml()print(xml)
输出
b'<k><item><k1>v1</k1></item><item><k3>v3</k3><k2>v2</k2></item></k>'<?xml version="1.0" ?><k> <item> <k1>v1</k1> </item> <item> <k3>v3</k3> <k2>v2</k2> </item></k>
https://github.com/quandyfactory/dicttoxml
attr_type
, Each element includes an optional type attribute with the data type.
xml.dom.minidom.parseString(xml).toprettyxml()
, return a pretty-printed version of the document.
0 0
- python dict转xml
- [转]Python Dict 用法
- python str转dict
- python string 转dict
- python str转dict
- python读取xml放入dict字典中
- python 中Dict 转 Json
- python两个list转dict
- Python中model转dict
- python json 转 dict , list
- python dict
- python dict
- python dict
- Python---dict
- python-dict
- python-dict
- Python dict
- Python dict
- POJ 2385 Apple Catching(线性DP)
- SpringMVC 过滤器HiddenHttpMethodFilter
- sysctl.conf学习和调优
- oracle两表关联更新
- 怎样做需求分析
- python dict转xml
- 使用springMVC的校验机制
- 冒泡排序及其改进算法
- 原生Notification
- LogMiner工具小结
- 前端随手优化不完全篇-SEO篇
- HDU
- linux 内核态调试函数BUG_ON()
- SparkSQL2.0扩展外部数据源原理