sorting values in dict
aleaxit at yahoo.com
Fri Jun 15 06:33:50 EDT 2001
"Victor Muslin" <victor at prodigy.net> wrote in message
news:3b292d23.1831931958 at localhost...
> This may not be the shortest or most efficient, but it does the trick:
> for k,v in a.items():
> for v,k in l:
> print v,k
I think it's pretty close, except that, to build l,
l = [(v,k) for k,v in a.items()]
may be (very slightly) shorter and more efficient.
More information about the Python-list