python - 如何替换xml里面的变量
大家讲道理
大家讲道理 2017-04-18 10:02:39
0
3
753
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
伊谢尔伦

Consider using the ElementTree module to parse and modify your XML.

Reference documentation https://docs.python.org/2/lib...

Peter_Zhu

xmltodict This package is very easy to use

大家讲道理

A suggestion:

1.用1楼提到的那个包解析xml dom结构
2.利用这个dom写一个jinja的xml模板
3.用jinja自带的渲染函数render把变量渲染进去
4.写到文件,完成
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template