Adding together the elements of list in nested dictionary - python -
I have nested dictionaries, outputs from the code given below. I have thus far, which is exactly what kind of Need and want them. I am trying to add list elements of the second dictionary group of ID numbers; In relation to the first dictionary, every element has happened to achieve total events; Which is a specific date
{'2014-06-14': {'205089113': [0, 1, 0, false, true], '268243219': [0, 1, [0, 0, 0, 0, false, true], '207018490': [0, 0, 0, 0, 0, 0, 0, 0, false, true], '207385741': [0, 0, 0, 0, false, false, true], '204059430': [0, 0, 0, false, true], '209169283': [0, 1, 0, false, true] is true], '204718647 ': [0, 1, 0, wrong, true],' 205438195 ': [0, 1, 0, wrong, true]},' 2014-06-20 ': {' 209989276 ': [1, 0, 0 , False, true], '209 9493 ': [1, 0, 0, false, true],' 207067397 ': [1, 0, 0, false, true],' 207919002 ': [1 , [1, 0, 0, false, true], '219797 ': [1, 0, 0, 0, false, true],' 204718498 ': [2, 1, 0, false, truth ], '204437024', false, true]},
what's mine Which means an example of this: '2014-06-14': [0,5,0,0,10], '2014-06-20': [8,1,0,0,7]}
Every time I try the Lennon () or the counter module, I get an important error
The code given below gives me the I The number of, but it can not crack the coding to add its list elements together, it is not certain that if there is a direct route that I do not understand or if it is possible Then
< Div class = "post-text" itemprop = "text"> I think your post output is incorrect and the expected output is equivalent to
{'2014-06-14': [0,5,0] , 0,10], '2014-06-20': [8,1,0,0,7]}
The following will conform to your needs:
d = { '2014-06-14': {'205089113': [0, 1, 0, false, true], '268243219': [[0, 0, 0, false, true], '207018490': [0, 0 '0, 0, 0, 0, 0, 0, false, true], [0, 0, 0, false, true],' 207385741 '[0, 0, 0, false, true],' 204059430 ': [0, 0, 0, [0, 0, 0, false, true], '204718647': [0, 1, 1, 2, 2] 0, wrong, Truth], '205438195': [0, 1, 0, false, true]}, '2014-06-20': {209989276 ': [1, 0, 0, false, true],' 209840693 ': [1 , [0, 0, false, true], '207067397': [1, 0, 0, false, true], '207919002': [1, 0, 0, false, true], '204718498': [2, 1 , 0, false, true], '204437024': [1, 0, 0, false, true], '219 9 9 31': Results for [1, 0, 0, false, true]}} = {}: D = values = zip (* d [key] .values ()) Results [key] = [value_tuple] value_tuple values] Print result
Comments
Post a Comment