dimanche 17 juillet 2016

How to read and store values from a text file into a dictionary, python


I'm trying to figure out how to open up a file and then store it's contents into a dictionary in python 2.7+, I want it to look like this , with key string, and value int

d = {"a": 1 "c": 2, "e": 3}

I looked at other posts here, but I wasn't able to figure it out...


Aucun commentaire:

Enregistrer un commentaire