Creating a dictionary from a .txt file
dreamingforward at gmail.com
Sun Mar 31 18:20:25 CEST 2013
> Every line is now an element in list d. The question I have now is how can
> I make a dictionary out of the list d with the car manufacturer as the key
> and a tuple containing the year and the model should be the key's value.
> Here is a sample of what list d looks like:
> ['1899 Horsey Horseless', '1909 Ford Model T', '1911 Overland OctoAuto',
> '2003 Hummer H2', '2004 Chevy SSR']
> Any help would be appreciated!
As long as your data is consistently ordered, just use list indexing. d
is your key, and (d,d) the key's value.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list