Skip to content

Instantly share code, notes, and snippets.

@jjgod
Created July 20, 2009 05:28
Show Gist options
  • Save jjgod/150177 to your computer and use it in GitHub Desktop.
Save jjgod/150177 to your computer and use it in GitHub Desktop.
a = [ [ 1, 10, "abc" ], [ 2, 3, "xyz" ], [ 1, 4, "aaa" ] ]
def compare(x, y):
if x[0] == y[0]:
return x[1] - y[1]
return x[0] - y[0]
a.sort(cmp=compare)
print a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment