我想創造詞典在Python的字典:動態字典的Python
假設我已經有一個包含密鑰列表:
keys = ['a', 'b', 'c', 'd', 'e']
value = [1, 2, 3, 4, 5]
假設我有一個數據字段的數值(其中20)
我想要定義,其存儲與給定到相應的值
for i in range(0, 3)
for j in range(0, 4)
dictionary[i] = { 'keys[j]' : value[j] }
個不同的字典的字典
因此,基本上,它應該是這樣的:
dictionary[0] = {'a' : 1, 'b' : 2, 'c' : 3, 'd': 4, 'e':5}
dictionary[1] = {'a' : 1, 'b' : 2, 'c' : 3, 'd': 4, 'e':5}
dictionary[2] = {'a' : 1, 'b' : 2, 'c' : 3, 'd': 4, 'e':5}
dictionary[3] = {'a' : 1, 'b' : 2, 'c' : 3, 'd': 4, 'e':5}
什麼是實現這一目標的最佳途徑?
你對[dict.copy()](http://docs.python.org/library/stdtypes.html#dict.copy)感興趣嗎? – mg007