其他分享
首页 > 其他分享> > 【笔记】OrderedDict():collections.OrderedDict,不一样的字典

【笔记】OrderedDict():collections.OrderedDict,不一样的字典

作者:互联网

OrderedDict():



aaa=OrderedDict()

aaa
OrderedDict()

aaa["out"]=OrderedDict()
aaa["out"]["in"]=123
aaa
OrderedDict([('out', OrderedDict([('in', 123)]))])

aaa["out"]["in"]
123

type(aaa)
collections.OrderedDict

aaa["oua"]=OrderedDict()
aaa
OrderedDict([('out', OrderedDict([('in', 123)])), ('oua', OrderedDict())])

aaa["oua"]["ia"]=121
aaa
OrderedDict([('out', OrderedDict([('in', 123)])),
             ('oua', OrderedDict([('ia', 121)]))])

普通的dict:

aaa={}
aaa["out"]={}

aaa
{'out': {}}

aaa["out"]["in"]=123
aaa
{'out': {'in': 123}}

标签:aaa,oua,121,123,collections,OrderedDict,字典,out
来源: https://blog.csdn.net/nyist_yangguang/article/details/118752410