Using ElementTree, I want to do the following:
1 - Open an XML file and read the text of a tag (works).
2 - Print out that value then change the value (works).
3 - Write the changed value back to the same tag in the XML file (Doesn't work).
import elementtree.ElementTree as ET
sKeyMap = ET.parse("KeyMap_Checklist.xml")
port_element = sKeyMap.find("/BrowserInformation/BrowserSetup/port")
port = port_element.text
print port
port = "2222"
port_element.text = port
newXmlContent = ET.tostring(sKeyMap)
fileObject = open("KeyMap_Checklist.xml", "w")
fileObject.write(newXmlContent)
fileObject.close()
Thx in advance