I have a dictionary of the following form
>>> {\'1\' : [V3210 , 234567 ,1235675 , 23], \'2\' : [v3214 , 5678 ,65879 ,89} , ...}
how to
Using Python's csv module would make doing this super simple:
import csv
d = {'1' : ['V3210', 234567, 1235675, 23], '2' : ['v3214', 5678, 65879 ,89], }
with open('output.csv', 'wb') as csvfile:
csv.writer(csvfile).writerows([row[0]] + row[1] for row in d.iteritems())
Note the iteritems()
dictionary method is gone in Python 3, so you'd need to use d.items()
instead.