sort one list using the values from another list

Brian Blais bblais at bryant.edu
Sun Feb 26 11:04:21 EST 2006


Hello,

I have two lists, one with strings (filenames, actually), and one with a real-number
rank, like:

A=['hello','there','this','that']
B=[3,4,2,5]

I'd like to sort list A using the values from B, so the result would be in this example,

A=['this','hello','there','that']

The sort method on lists does in-place sorting.  Is there a way to do what I want here?


		thanks,

			Brian Blais

-- 
-----------------

             bblais at bryant.edu
             http://web.bryant.edu/~bblais




More information about the Python-list mailing list