Skip to content

Instantly share code, notes, and snippets.

@tkheyfets
Last active March 16, 2018 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkheyfets/4176fe93e4af5fceca0dbfd1b504b920 to your computer and use it in GitHub Desktop.
Save tkheyfets/4176fe93e4af5fceca0dbfd1b504b920 to your computer and use it in GitHub Desktop.
def function_name (collection, k):
result = {}
for x in collection:
prop = x[k]
if prop not in result:
result[prop] = []
result[prop].append(x)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment