Hey guys, i have a problem with reading csv files. I have a csv file which i would like to read and save to a dictionary.
Preview of the file:
and so on..
The way that i would like it to save is basically for example mpg is the key, while 18,15,18,16.. are the items. (ex. mpg:18,15,17...)
I have tried to do it with and without the csv class, but i still can't make it to save the variable as a key into a dictionary. I've managed to save the entire csv file to an array, but it isn't what im after and therefore i can't post any code that would help.

Thanks in advance for all the help.


Recommended Answers

All 3 Replies

I tried all of the sample code given on that link, but only one was a match to what i was searching, but it was a bit overcomplicated with that extra class in it (amateur in python), so im still looking for a bit more simple code..

How about my named tuple code in code snippets?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.