Exporting A List To A Csv Or Xml And Each Sublist In Its Own Column - Repost
Solution 1:
XML isn't really a row and column based format like csv; it's hierarchical, and probably not the best format for storing row/column data. You would need tags to specify rows and columns, and if you're importing this into another application, it would need to know what the row and column tags were to parse it correctly.
Is the second application written in python as well? If so, just use the python pickle module to serialize your 2D python list. That way your 2nd app can just read it back in as a 2D list, instead of marshaling it back and forth to csv or xml.
Solution 2:
Your last solution should work just fine. What error did you get?
To convert to xml, you can simply create a dictionary for each "row" and use one of the solutions listed here: Serialize Python dictionary to XML.
Post a Comment for "Exporting A List To A Csv Or Xml And Each Sublist In Its Own Column - Repost"