Find the maximum value in a list of tuples in Python [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Sorting or Finding Max Value by the second element in a nested list. Python I have a list with ~10^6 tuples in it like this: [(101, 153), (255, 827), (361, 961), ...] ^ ^ X Y I want to find the maximum value of the Ys in this list, but also want to know the X that it is bound to. How do I do this? 回答1: Use max() : Using itemgetter() : In [53]: lis=[(101, 153), (255, 827), (361, 961)] In [81]: from operator