[CentralOH] Python reversed() Question

Fandi Peng fandi.814 at gmail.com
Fri Apr 20 03:12:39 CEST 2012

Hi guys, I have a question:
Suppose I have a list, every element in the list is a tuple,
every tuple has two elements,
e.g. [("D3","E4"), ("A3", "B2"), ("A2","C4")....]
Therefore, if I sorted the list, the tuples would be rearranged
based on the first element of each tuple:
e.g. [("A2","C4"), ("A3", "B2"), ("D3","E4")....]
Now I want this list to be sorted based on the second element
of each tuple:
e.g. [("A3", "B2"), ("A2","C4"), ("D3","E4"),....]
What's the simplest code could you come up to achieve

More information about the CentralOH mailing list