Prepare dict of lists
# get it
from itertools import product
storage = dict(product(list_of_keys, [[]]))
# use it
for item in items:
storage[get_item_type(item)].append(item)
Written by v.petrov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Related Tags
#python
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#