Closed mhebing closed 8 years ago
a = [] b = [] a.append(1) b.append(2)
x = dict( a=[], b=[], ) x["a"].append(1) x["b"].append(2)
from collections import defaultdict x = defaultdict(list) x["a"].append(1) x["b"].append(2)
Version 1
Version 2
Version 3