I am new to programming and Python and need to write a script so I can output data to Excel. For this purpose I am currently writing to a CSV.
However, I have a requirement to show this data so it is readable and am not sure how to achieve this.
I have a matrix of data
[
['FileName', 'File1', 'File2'],
['Count', '1643', '1646'],
['SomeNumbers', ['-15,51,-58,17'], ['-15,51,-58,17']],
['MoreData', ['a', 'b', 'c', 'd' ], ['a', 'b', 'c', 'd']]
]
To print this, I wrote:
for item in matrix:
writer.writerow(item)
I wrote the results to a CSV and got this:
FileName FileA FileB
FeatureType Polygon Polygon
FeatureCount 1643 1646
SomeNumbers ['-15,51,-58,17'], ['-15,51,-58,17']
MoreData ['a', 'b', 'c', 'd'] ['a', 'b', 'c', 'd']
What I would like to do is to write code such that I get output like this instead:
FileName FileA FileB
FeatureType Polygon Polygon
FeatureCount 1643 1646
SomeNumbers -15 -15
51 51
-58 -58
17 17
MoreData a a
b b
c c
d d
Thanks for your help.