print '--------------begin-dict------------------'
#初始化一个字典
d = dict({'one': 1, 'two': 2})
print d
d = dict(one=1, two=2)
print d
d = dict([(['one', 'two'][i - 1], i) for i in (1, 2)])
print d
d = dict({'one': 1, 'two': 2}.items())
print d
d = dict(zip(('one', 'two'), (1, 2)))
print d
print '--------------end-dict------------------'
输出:
--------------begin-dict------------------
{'two': 2, 'one': 1}
{'two': 2, 'one': 1}
{'two': 2, 'one': 1}
--------------end-dict------------------