'How to map a value from python code to tag <title value="${document[n].title}"/> in xml file

I have a dictionary {"title": "Product-1"}. I want to map this value to an xml template file (template.xml). This xml has lot of tags. One of the tag is \<title value="${document\[n\].title}"/\>.

How can I map a value to xml file from python code?

I've tried lxml but am unable to map the value.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source