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:
<car>
<lights>
<blinkers>off</blinkers>
</lights>
</car>
Now I want to see whether the blinkers are on or off, using xml.etree.ElementTree.
import xml.etree.ElementTree as ET
tree = ET.parse('car.xml')
blinkers = tree.findtext('lights/blinkers')
print blinkers
> off
Now I want to turn the blinkers on and off, how can I do this?
settingswith module level constants in ALLCAPS that have whatever information you thought you wanted to store in xml. You can have tuples, lists, dictionaries, integers, floats, etc. When some part of your application needs a setting, FOO, it can just doimport settings; settings.FOO.