Skip to content

Instantly share code, notes, and snippets.

@sxslex
Created December 3, 2014 16:21
Show Gist options
  • Save sxslex/0edd432426770af63251 to your computer and use it in GitHub Desktop.
Save sxslex/0edd432426770af63251 to your computer and use it in GitHub Desktop.
list sort lambda
voo = [
('KLM75', 'Amsterdam', '14:35', '60', '50'),
('AF111', 'Paris', '14:20', ' 50', '64'),
('LH333', 'Frankfurt', '14:10', '112', '203'),
('KLM71', 'Madrid', '14:55', '120', '100'),
('TAP103', 'Salvador', '15:20', '174', '210'),
('KLM79', 'Sofia','09:30','113','13'),
('LH123', 'Berlin', '15:10', '115', '210')]
voo.sort(lambda x, y: cmp(x[2], y[2]))
print(voo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment