开发者

How to update xml file using lxml and python?

<example>
    <login>
        <id>1</id>
        <username>kites</username>
        <password>kites</password>
    </login>
</example>

How can i update p开发者_如何学运维assword using lxml? and now can i add one more record to the same file?

please provide me a sample code


example = etree.Element("example")
login = etree.SubElement(example, "login")
password = etree.SubElement(login,"password")
password.text = "newPassword"

This is a good tutorial

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜