如何一次添加多个嵌套词典?
我有一个方法,需要能够一次添加多个嵌套字典。
例如:
mydict = {}
mydict['subdict']['subdict2'] = {'this': 'is what i want'}
我该怎么做?
I have a method which requires being able to add multiple nested dictionaries at once.
For example:
mydict = {}
mydict['subdict']['subdict2'] = {'this': 'is what i want'}
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会在字典内创建一个空字典以便嵌套字典。
这里;
I would create an empty dict inside the dict in order to have nested dict.
Here;