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 :


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -