3 ms·
This works fine too, dict((k, []) for k in keys) Although I later realized what I really needed was defaultdict[1] d = defaultdict(list) [1]: http://d
by naiquevin 14y ago
This works fine too,
dict((k, []) for k in keys)
Although I later realized what I really needed was defaultdict[1]
d = defaultdict(list)
[1]: http://docs.python.org/2/library/collections.html#collections.defaultdict http://docs.python.org/2/library/collections.html#collection...