Created
June 25, 2019 10:54
-
-
Save mayhem/790831809d354b0d3c5994958a0c69ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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