Simple question: Can I store lists in a CSV file? If so, how do I retrieve it?
Here is the file content that I wrote to the file, and I'm now having a hell of a time trying to retrieve it.
40;['5', '0'];['15', '0'] ; ['25', '0'] ; ['30', '0'] ; ['40', '0'] ; ['50', '0'].....
50; ['0', '0'] ; ['10', '0'] ; ['15', '0'] ; ['25', '0'] ; ['30', '0'] ; ['40', '0'].....
60; ['0', '0'] ; ['10', '0'] ; ['15', '0'] ; ['20', '0'] ; ['25', '0'] ; ['30', '0'].....
70; ['0', '0'] ; ['5', '0'] ; ['10', '0'] ; ['15', '0'] ; ['20', '0'] ; ['30', '0'].....
And this is some code I've played with to try and retrieve it:
import csv
reader = csv.reader(open("NewTableInfo", "r"), delimiter=';')
for row in reader:
print (row)
This results in a list in which the values that are in brackets are type string. I want them to be lists (In another file I make each row a dictionary item).
['40', "['5', '0']", "['15', '0'] ", " ['25', '0'] ", " ['30', '0'] "......
Any ideas? Is it possible to write CSV files, in the way that I did above, and have them be usable?