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 my password with lxml? and now can i add another entry to the same file?

please provide me a sample code

+4
source share
1 answer
 example = etree.Element("example") login = etree.SubElement(example, "login") password = etree.SubElement(login,"password") password.text = "newPassword" 

This is a good tutorial.

+3
source

Source: https://habr.com/ru/post/1298981/


All Articles