Mettre à jour la valeur dans XML Python
import xml.etree.ElementTree as ET
filename = "example.xml"
xmlTree = ET.parse(filename)
rootElement = xmlTree.getroot()
for element in rootElement.findall("book"):
#Find the book that has title as 'Python Tutorial'
if element.find('title').text == 'Python Tutorial' :
#Change the price
element.find('price').text = "50.00"
#Write the modified xml file.
xmlTree.write(filename,encoding='UTF-8',xml_declaration=True)
Omri Bashan