list to map?
Quinn Dunkan
quinn at groat.ugcs.caltech.edu
Tue May 18 20:47:50 EDT 1999
On 18 May 1999 18:18:03 -0400, Dan Schmidt <dfan at harmonixmusic.com> wrote:
>bruce.guenter at qcc.sk.ca (Bruce Guenter) writes:
>
>| 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.
>
>OK, here's a different way. Look, ma, no looping!
>
[ monstrosity clipped ]
c.l.py seems to be in a Tim-Petersly mood lately. If what you meant was "is
there a faster way" take a look at mxTools.dict() at
http://starship.python.net/~lemburg/
More information about the Python-list
mailing list