python defaultdict set keys code example
Example: defaultdict initialize keys
d = {'a' : 1, 'b' : 2, 'c' : 3}
default_d = defaultdict(list, **d)
# or
d = defaultdict(list,{ k:[] for k in ('a','b','c') })
d = {'a' : 1, 'b' : 2, 'c' : 3}
default_d = defaultdict(list, **d)
# or
d = defaultdict(list,{ k:[] for k in ('a','b','c') })