【笔记】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}}

上一篇:SpringMvc的请求和响应


下一篇:CoProcessFunction实战三部曲之二:状态处理