On 29 March 2011 23:52, Sander Sweers <sander.swe...@gmail.com> wrote: > On 29 March 2011 22:03, ranjan das <ranjand2...@gmail.com> wrote: >> New_List=[ [ ( 'G1', 'CFS', 'FCL', 'R1' ), ('G1', 'CFS', 'FCL', 'R2' ), >> ('G4', 'CFS', 'FCL', 'R10' ) ], [ ('G2', 'LOOSEFREIGHT', 'LCL', 'R4' ), >> ('G2', 'LOOSEFREIGHT', 'LCL', 'R5' )], [ ('G3', 'LOOSEFREIGHT', 'MIXEDLCL', >> 'R9')] ]
Hmm, looking at your New_list you actually want to sort on 3 "indexes", on 1 then 0 then 2. So change the key= part from before to key=operator.itemgetter(1,0,2) and it will match your New_list perfectly. Greets Sander _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor