list to map?
M.-A. Lemburg
mal at lemburg.com
Wed May 19 03:54:44 EDT 1999
Bruce Guenter wrote:
>
> Greetings.
>
> I have a list of two-item tuples:
> x=[(1,2),(3,4),(5,6)...]
> Is there a built-in way to turn this into a map:
> {1:2,3:4,5:6...}
> I have done the obvious of looping over the tuples and adding them to a
> map, but was wondering if there was a different way.
There's the dict() built-in function in mxTools that does exactly
this:
http://starship.skyport.net/~lemburg/mxTools.html
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 226 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
More information about the Python-list
mailing list