One-line defaultdict initialization with existing data.
2020
from collections import defaultdict x = {"1": 1, "2": 2} defaultdict(int, x)
View gist