Skip to content

Instantly share code, notes, and snippets.

@mayhem
Created June 25, 2019 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayhem/790831809d354b0d3c5994958a0c69ca to your computer and use it in GitHub Desktop.
Save mayhem/790831809d354b0d3c5994958a0c69ca to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
data = [(5, "Pogues, The"), (6, "void"), (2, "U2"), (3, "Foo Fighters"), (1, "Zambiana"), (7, "void")]
data_index = list(range(len(data)))
data_index = sorted(data_index, key=lambda rec: data[rec][1])
for i in data_index:
print(data[i])
(3, 'Foo Fighters')
(5, 'Pogues, The')
(2, 'U2')
(1, 'Zambiana')
(6, 'void')
(7, 'void')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment