Nov-24-2019, 10:50 AM
(Nov-24-2019, 10:32 AM)DeaD_EyE Wrote: The csv module can do this for you.
import csv result = [] with open('PL.csv') as fd: reader = csv.DictReader(fd) for row in reader: result.append(row) print(result)You get a list with dicts. The headers are included as keys in the dicts.
https://docs.python.org/3/library/csv.ht...DictReader
If you scroll down, you see some other examples.
Thank you for your reply.
I am looking to import the csv file into columns in a dictionary.
Your code above loads the csv data in and labels it correctly etc.
Is the data already in columns with this code and if so how do I access individual items lke the 5th best team etc?