Hey. I want to have a config.xml file for settings in a Python web app.
I made car.xml manually. It looks like this:
Without addressing the merits of using XML instead of a Python module for managing configuration files, here's how to do what you asked using lxml:
>>> from lxml import etree
>>> xml = """
on
"""
>>> doc = etree.fromstring(xml)
>>> elm = doc.xpath("/car/lights/blinkers")[0]
>>> elm.text="off"
>>> etree.tostring(doc)
'\n \n off \n \n '