I have data in xml file and I am reading 3 columns : price , name , calories xml data Code : The above code gives me data but need to store this data to csv file How do I need to write logic for this. Is it possible to do with pandas / csv Need to add my headers
Tag: xml.etree
How can I transfer the attributes of parent elements to child elements in XML using python?
Given the following structure of XML file: how can transfer the attributes from parent to child and delete the parent element to get the following structure: Answer Well, you need to find <parent>, then find <child>, copy attributes from <parent> to <child>, append <child> to root node and remove <parent>. Everything is that simple: Result: