How do I sort these?
Diez B. Roggisch
deets at nospam.web.de
Fri Oct 28 15:00:58 EDT 2005
KraftDiner wrote:
> I have two lists.
> I want to sort by a value in the first list and have the second list
> sorted as well... Any suggestions on how I should/could do this?
I guess you mean that you have two lists of same size where each index
position pointing to corrsponding items - like two excel columns? Then
this helps:
sl = zip(list_a, list_b)
sl.sort()
list_a, list_b = unzip(*sl)
Regards,
Diez
More information about the Python-list
mailing list