Mar 4, 2023
Those first six lines could be replaced by these two lines:
from collections import Counter
counts = Counter(i.split()[6] for i in open(filename))
In general, there is almost never a good use for defaultdict
given that dict.setdefault()
exists.
Great article in general, I’m just quibbling. Have claps!