Skip to content

Instantly share code, notes, and snippets.

@kentquirk
Created September 10, 2016 19:25
Show Gist options
  • Save kentquirk/e62ba1ead9ebad0ad0730debd5be340b to your computer and use it in GitHub Desktop.
Save kentquirk/e62ba1ead9ebad0ad0730debd5be340b to your computer and use it in GitHub Desktop.
Python one-liner (bad idea!)
# oneline
output = dict([(o, [e["pet"] for e in input if e["owner"] == o]) for o in set((i["owner"] for i in input))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment