Skip to content

Instantly share code, notes, and snippets.

@gardyna
Created May 9, 2015 13:30
Show Gist options
  • Save gardyna/cc51e123e89c2a0f7875 to your computer and use it in GitHub Desktop.
Save gardyna/cc51e123e89c2a0f7875 to your computer and use it in GitHub Desktop.
#list construction
my_dict = dict()
for l in lists:
for name in lst:
my_dict[name] = my_dict.get(name, 0)+1
# dict.get(key, default) return value associated with key or default if none is found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment