sorting list in python accoeding to one dimension [duplicate]
Possible Duplicate:
Sorting a tuple that contains tuples
hi
I have a list that goes A=[[a,'3'],[g,'1'],[y,2]] I am looking for a quick way to arrange it according to the numbers (second dimension), so NewA=[[g,'1'],[y,'2'],[a,'3']] thanks arielfrom operator import itemgetter
newA = sorted(a, key=itemgetter(1))
精彩评论