如何一次添加多个嵌套字典?

How to add multiple nested dictionaries at once?

我有一个方法需要能够一次添加多个嵌套词典。

例如:

mydict = {}
mydict['subdict']['subdict2'] = {'this': 'is what i want'}

我该怎么做?

from collections import defaultdict
mydict = defaultdict(dict)
mydict['subdict']['subdict2'] = {'this': 'is what i want'}