pandas - python - writing into excel -
i m new python. m able parse xml don't know how write 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 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 strawberries , whipped cream</description> <calories>900</calories> </food>
my code:
import xml.etree.elementtree etree xmld = etree.parse('simple.xml') root = xmld.getroot() child in root: children in child: print children.tag," : % s" %children.text
output:
name : belgian waffles price : $5.95 description : 2 of our famous belgian waffles plenty of real maple syrup calories : 650 name : strawberry belgian waffles price : $7.95 description : light belgian waffles covered strawberries , whipped cream calories : 900
need write excel like
'tags' column , 'values' column b enter image description here
tried xlwt or openpyxl or pandas..but no luck...pls help..
from site : http://www.python-excel.org/ , can try :
- openpyxl : https://openpyxl.readthedocs.io/en/default/
- xlsxwriter : https://xlsxwriter.readthedocs.io/
- xlrd : http://xlrd.readthedocs.io/en/latest/
- xlwt : http://xlwt.readthedocs.io/en/latest/
- xlutils : http://xlutils.readthedocs.io/en/latest/
Comments
Post a Comment