1try:
2 import xml.etree.cElementTree as ET
3except ImportError:
4 import xml.etree.ElementTree as ET
5import pandas as pd
6
7tree = ET.parse("file1.xml")
8root = tree.getroot()
9iter_root = root.iter()
10
11l = {}
12for elem in iter_root:
13 l[str(elem.tag)] = str(elem.text)
14
15df = pd.DataFrame.from_dict(l,orient="index")
16
17df.to_csv('ABC.csv')
18