Outputting A Python Dictionary With Values In An Array To A Csv File.
First question here, please forgive the various and sundry errors I'm sure to make. I've been working on this for awhile, and I admit to being stumped - dictionaries in a general s
Solution 1:
Replace
writer.writerow([node,value])
with
writer.writerow([node]+value)
Solution 2:
You're passing a list containing a name and a list with two numbers to writer.writerow
. To get what you want, flatten the list into just a list of the name and numbers. Simple approach:
for node, value in output.items():
writer.writerow([node] + value)
Post a Comment for "Outputting A Python Dictionary With Values In An Array To A Csv File."