Help with creating a dict from list and range

Echo oshecho at
Fri Oct 14 15:26:18 CEST 2005

Here is what I am trying to do. I am trying to make a dict that has a key
that is the value an element in a list and the value for the dict to be the
This is the closest I have been able to get:
dict((d[0],i) for d in for i in xrange(len(

That however does not work. the value for all the dict is 40. Not 1, 2, 3,
... that I was hoping for.

Am I even close at creating the dict that I want? Is there a better way to
go about it?

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

More information about the Python-list mailing list