Python Programming - Standard Libraries - Discussion
Discussion Forum : Standard Libraries - General Questions (Q.No. 87)
87.
How can you use the
xml.etree.ElementTree
module in Python to parse an XML file?
Answer: Option
Explanation:
import xml.etree.ElementTree as ET
# Example usage of xml.etree.ElementTree module for parsing an XML file
tree = ET.parse('data.xml')
root = tree.getroot()
for element in root:
print(element.tag, element.attrib)
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers