python OrderedDict与Dict的区别

1、而使用OrderedDict时我们需要从collections模块引入OrderedDict,Dict作为python内置的数据类型,所以可以直接使用;Python其它一些内置的数据类型,像str、int、list、tuple、dict。

2、python中字典Dict跟OrderedDict最大的区别就是:OrderedDict是有顺序的,而Dict是无序的。

从OrderedDict源代码中我们可以看出OrderedDict继承Dict,并且(Dictionary that remembers insertion order)OrderedDict记录插入的顺序。

作者:军林天下
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/zoujl/p/10910578.html