"Sean Berry" <[EMAIL PROTECTED]> writes: > myList = [[value1, value2, value3],[value1, value2, value3], ...] > > I have a function which takes value3 from the lists above and returns > another value. I want to use this returned value to sort the lists. > > So, my resultant list would be ordered by the return value of the > function with value3 as its argument. > > From a relative Python newb, what is the best way to do this?
def get_key(x): return x[2] sorted_list = sorted(myList, key=get_key) -- http://mail.python.org/mailman/listinfo/python-list