Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xml.etree.ElementTree as et
- if __name__ == '__main__':
- tree = et.parse("xml_folder/country.xml")
- print(type(tree))
- print(tree)
- root = tree.getroot()
- print(type(root))
- print(root)
- for child in root:
- child.text = child.text.upper()
- child.attrib["iso"] = "45"
- print(child.text, child.attrib)
- tree.write("xml_folder/country_2.xml")
RAW Paste Data