On Nov 17, 8:56 pm, asc <[EMAIL PROTECTED]> wrote: > But my problem is this. I have a list, that contains a number of > embeded lists; > e.g. L2 = [['something', 'bb'], ['somethingElse', 'cc'], > ['anotherThing', 'aa']] > Now I want to sort this list by the second item of each sublist. So > the outcome I would like is; > L2 = [['anotherThing', 'aa'], ['something', 'bb'], ['somethingElse', > 'cc']] > > Is there a way I can use sort for this?
Yes. Read the manual. Look for the key argument. You need to make up a function (using def or lambda) that will pluck the desired sort-key out of a sub-list. -- http://mail.python.org/mailman/listinfo/python-list