相关疑难解决方法(0)

"d = dict()"和"d = {}"之间的差异

$ python2.7 -m timeit 'd={}'
10000000 loops, best of 3: 0.0331 usec per loop
$ python2.7 -m timeit 'd=dict()'
1000000 loops, best of 3: 0.19 usec per loop
Run Code Online (Sandbox Code Playgroud)

为什么用一个而不是另一个?

python performance dictionary timing

35
推荐指数
4
解决办法
2万
查看次数

标签 统计

dictionary ×1

performance ×1

python ×1

timing ×1