Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

update value in 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)
Comment

PREVIOUS NEXT
Code Example
Python :: how to add other categories in django admin template 
Python :: 1042 uri solution 
Python :: create list python 
Python :: map column dataframe python 
Python :: Fill NaN with the first valid value starting from the rightmost column, then extract first column 
Python :: Add value on top of each bar using function 
Python :: python multi arguments 
Python :: filetype: env "DB_PASSWORD" 
Python :: replace python enter number of characters 
Python :: image name validate using regex python 
Python :: python dummy command 
Python :: write yaml file without deleting content 
Python :: pydrive download file 
Python :: studygyaan python everywhere - host on heroku 
Python :: multi line cooment in python 
Python :: (function(a_,%20b_)%20%7B%20with%20(a_)%20with%20(b_)%20return%20summary%20%7D) 
Python :: connect elasticsearch cloud with python terminal 
Python :: can you use the astro a50 with a phone 
Python :: getting heading from a webpage in beautifulsoup 
Python :: sorting-a-dictionary-by-value-then-by-key 
Python :: how to access cookies in django 
Python :: sowpods python 
Python :: in python how to end the code after 10 input 
Python :: numpy stack in new dimension 
Python :: python write request must be str not bytes 
Python :: how to use Py-agender for projects 
Python :: django 2.2 disable cache settings.STATIC_URL 
Python :: how to use put method in django 
Python :: Deques in python3 
Python :: ggt euklidischer algorithmus python 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =