sorting two corresponding lists?
ebonak at hotmail.com
Mon Apr 20 18:57:18 CEST 2009
Thanks for this, I had seen zip() before but had no idea
really what it does, this will serve as good motivation to
find out more.
I'm amazed at what this language can do (and the helpfulness
of the people on the list here).
Diez B. Roggisch wrote:
> items = zip(*sorted(zip(values, items)))
> To better understand this please note that
> a = [1, 2]
> b = [3, 4]
> zip(*zip(a, b)) == a, b
> or, in other words, zip(*argument) is the inverse of an argument created by
> zip (under the assumption the a and b have equal length)
More information about the Python-list