How to sort list of lists by highest number?
问题 This is my list: [['Alfred Jeffries', '9'], ['Peter Smalls', '10'], ['Bob Daniels', '8']] I want to sort this numerically, highest to lowest. Expected outcome: [['Peter Smalls', '10'], ['Alfred Jeffries', '9'], ['Bob Daniels', '8']] Thanks! 回答1: Use key to specify a function of one argument that is used to extract a comparison key from each list element. The argument reverse is a boolean value. If set to True, then the list elements are sorted as if each comparison were reversed. >>> l = [[