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

How can i update password using lxml? and now can i add one more record to the same file?

please provide me a sample code

1 Answer 1

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

This is a good tutorial

Sign up to request clarification or add additional context in comments.

1 Comment

after this we need to call etree.write(filepath) make make effect in xml file i have found another tutorial which i think is better infohost.nmt.edu/tcc/help/pubs/pylxml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.