For example
import collections d = collections.defaultdict(lambda:collections.defaultdict(float))
If you do like
d['poko']['hoge'] += 1.0
You can write a countup like this without writing setdefault
Recommended Posts