字典和集合

Posted stackneveroverflow

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了字典和集合相关的知识,希望对你有一定的参考价值。

字典构造方法:

a = dict(one=1, two=2, three=3)
b = {one:1, two:2, three:3}
c = dict(zip([one,two,three],[1,2,3]))
d = dict([(one,1),(two,2),(three,3)])
e = dict({one:1, two:2, three:3})

print(a==b==c==d==e)

输出:
True

 




以上是关于字典和集合的主要内容,如果未能解决你的问题,请参考以下文章

13 个非常有用的 Python 代码片段

代码片段 - Golang 实现集合操作

laravel特殊功能代码片段集合

Python字典集合结构详解

Python代码阅读(第19篇):合并多个字典

带有红宝石集合/可枚举的酷技巧和富有表现力的片段[关闭]