[Ervan Ensis] > I have a list like [108, 58, 68]. I want to return > the sorted indices of these items in the same order > as the original list. So I should return [2, 0, 1]
One solution is to think of the list indexes being sorted according the their corresponding values in the input array: >>> s = [ 108, 58, 68 ] >>> sorted(range(len(s)), key=s.__getitem__) [1, 2, 0] Raymond -- http://mail.python.org/mailman/listinfo/python-list