Skip to content

Instantly share code, notes, and snippets.

@ken8203
Created March 10, 2017 08:51
Show Gist options
  • Save ken8203/3b38c57ec73f2f2c5fafdf3e7578d45a to your computer and use it in GitHub Desktop.
Save ken8203/3b38c57ec73f2f2c5fafdf3e7578d45a to your computer and use it in GitHub Desktop.
values = [
(0.1, 'a'),
(0.004, 'c'),
(0.59643590, 'd'),
(100, 'k')
]
values.sort(key=lambda x: x[0])
print values
values.sort(key=lambda x: x[0], reverse=True)
print values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment