how to open xml file element tree

Solutions on MaxInterview for how to open xml file element tree by the best coders in the world

showing results for - "how to open xml file element tree"
Sara
14 Jul 2018
1import xml.etree.ElementTree as ET
2
3root = ET.fromstring(country_data_as_string)
Gustave
25 Oct 2020
1import xml.etree.ElementTree as ET
2
3tree = ET.parse('filename.xml') #this gets the file into a tree structure
4tree_root = tree.getroot() #this gives us the root element of the file