How to convert a list of lists into a CSV file format in python?
This is what I have, a list of lists:
[
['Node', 'Resource', 'Actual Number', 'Maximum Number Allowed', 'Usage'],
['node1', 'AuC Data Management', '5586618', '5820000', '95%'],
['node2', 'Enhanced Multi-Level Precedence and Pre-Emption Service (eMLPP)', '1', '3001', '0%']
...
]
What I want csv:
Node,Resource,Actual Number,Maximum Number Allowed,Usage
node1,AuC Data Management,5586618,5820000,95%
node2,Enhanced Multi-Level Precedence and Pre-Emption Service (eMLPP),1,3001,0%
...
Apologies but its been a while since I looked at python and this is what I am working on so far:
>>> x
[['Node', 'Resource', 'Actual Number', 'Maximum Number Allowed', 'Usage'], ['node1', 'AuC Data Management', '5586618', '5820000', '95%'], ['node2', 'Enhanced Multi-Level Precedence and Pre-Emption Service (eMLPP)', '1', '3001', '0%']]
>>> x[0]
['Node', 'Resource', 'Actual Number', 'Maximum Number Allowed', 'Usage']
In addition, is there a library/resource out there with some code that can make this conversion for the various permutations that the list of lists could come in?
Possible related question:
Python csv file writing a list of lists
Writing a Python list of lists to a csv file
CSV IO python: converting a csv file into a list of lists
Write a list of lists into csv in Python
Convert this list of lists in CSV