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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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