How to return a specific data structure with inner dictionary of lists
问题 I have a csv file (image attached) and to take the CSV file and create a dictionary of lists with the format " {method},{number},{orbital_period},{mass},{distance},{year} " . So far I have code : import csv with open('exoplanets.csv') as inputfile : reader = csv.reader(inputfile) inputm = list(reader) print(inputm) but my output is coming out like ['Radial Velocity', '1', '269.3', '7.1', '77.4', '2006'] when I want it to look like : "Radial Velocity" : {"number":[1,1,1], "orbital_period":[269