Created
April 25, 2017 19:15
-
-
Save alothings/e12f4a6ae7ca0a1c9326f7f57acd810c 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
def func(row): | |
return int(row.split()[k]) | |
if __name__ == '__main__': | |
n, m = map(int, input().split()) | |
rows = [input() for _ in range(n)] | |
k = int(input()) | |
# for row in sorted(rows, key=lambda row: int(row.split()[k])): #works | |
for row in sorted(rows, key=func(row)): #doesn't work | |
print(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment