I m new to python. actually I m able to parse an xml but don't know how to write this into excel.
sample xml:
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>Two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>Light Belgian waffles covered with strawberries and whipped cream</description>
<calories>900</calories>
</food>
my Code:
import xml.etree.ElementTree as etree
xmld = etree.parse('simple.xml')
root = xmld.getroot()
for child in root:
for children in child:
print children.tag," : % s" %children.text
output:
name : Belgian Waffles
price : $5.95
description : Two of our famous Belgian Waffles with plenty of real maple syrup
calories : 650
name : Strawberry Belgian Waffles
price : $7.95
description : Light Belgian waffles covered with strawberries and whipped cream
calories : 900
Need to write this into excel like
'tags' into Column A and 'values' into column B enter image description here
Tried with xlwt or openpyxl or pandas..but no luck...pls help..