Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
Created May 16, 2018 01:36
Show Gist options
  • Save hughdbrown/2157b59e3fb2c985adf387533add416e to your computer and use it in GitHub Desktop.
Save hughdbrown/2157b59e3fb2c985adf387533add416e to your computer and use it in GitHub Desktop.
from operator import itemgetter
from pprint import pprint
data = [
{'a': a, 'b': b}
for a in reversed(range(4))
for b in reversed(range(10, 18, 2))
]
pprint(data)
sorted_data = sorted(data, key=itemgetter('a', 'b'))
pprint(sorted_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment