Composite python dictionary with several values from other dictionaries in an identical key
📁 словарь, python, вопрос, пример
I will immediately make a reservation & ndash; I am not a programmer, but I study Python for my own specific purposes (processing data obtained from the network), so if my question seems naive and simple & ndash; I ask you not to blame.
So, there are three different dictionaries with identical keys. Values & ndash; Different, but can coincide both within one dictionary and in different dictionaries. For example (I did the values in the form of a list, because I understand that it will not work out to add values in a different way):
Dict_1 = { `` `SPAN>: [ 2 ], 'b' : [ 8 ], 'c' : [ 6 ], 'd' : [ 2 ]} dict_2 = { '' a 'a' 2 ], 'b' : [ 7 ], 'c' : [ 7 ], 'd' : [ 3 ]} dict_3 = { 'a' a ': [ 3 ], ' b ': 6 ], 'c' : [ 8 ], 'd' : [ 3 ]} pre> Task: to get a new dictionary (either from scratch or based on one of these & ndash; absolutely not important) in which each key will receive values from all three dictionaries:
DICT_ALL = { 'a' : [ 2 , 2 , 3 ], 'b' : [ 8 , 7 , 6 ], 'c' : [ 6 , 7 , 8 ], 'd' : [ 2 , 3 , 3 ]}
Ответов пока нет.
Войдите чтобы оставить ответ
Блоги