标签:两种方法 字典 pre earth dict 工厂方法 创建 方法 pytho
>>> dict1 = {‘name‘: ‘earth‘, ‘port‘: 80}
>>> dict2 = {}
>>> dict1,dict2
({‘name‘: ‘earth‘, ‘port‘: 80}, {})
>>>
工厂方法创建字典
>>> dict3 = dict(([‘x‘,1],[‘y‘,2]))
>>> dict3
{‘y‘: 2, ‘x‘: 1}
>>>
标签:两种方法 字典 pre earth dict 工厂方法 创建 方法 pytho
原文地址:http://blog.51cto.com/yht1990/2144323