How to sort a list alphabetically and have additional lists sorted in the same order

Posted by Carl on Stack Overflow See other posts from Stack Overflow or by Carl
Published on 2010-04-01T18:34:00Z Indexed on 2010/04/01 18:43 UTC
Read the original article Hit count: 448

Filed under:
|
|

I have 3 lists, each with equal elements: email addresses, salaries and IDs

I'd like to sort the email addresses alphabetically and in some way sort the other 2 lists (salaries and IDs).

E.g.,
Emails:
[email protected]
[email protected]

Salaries:
50000
60000

IDs:
2
1

The puzzle: I'd like to sort Emails such that [email protected] is first and [email protected] is last and Salaries is 60000 then 50000 and IDs is 1 then 2.

Additional detail: 1. Length of lists are the same and can be longer than two elements. 2. I will subsequently pass IDs to functions to retrieve further lists. Those lists won't need sorting as they will adopt the order of the IDs list.

© Stack Overflow or respective owner

Related posts about python

Related posts about sort