Creating a dictionary from a .txt file

Mark Janssen dreamingforward at
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[2]
is your key, and (d[1],d[3]) the key's value.

Tacoma, Washington
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list