Reputation: 3
this is the following
data = {"A": [["a", 4, 4.50],["b", 5, 3.50]], "C": [["c", 7, 27.00],["d", 1, 7.99]]}
if I want to change only 3rd items of 2nd value of key "C" (["d", 1, (7.99)])
into like
date = {"A": [["a", 4, 4.50],["b", 5, 3.50]], "C": [["c", 7, 27.00],["d", 1, 5.25]]}
how would you update the value inside of 2D list?
Upvotes: 0
Views: 1718
Reputation: 20361
I guess you mean:
data['C'][1][2] = 5.25
so what this does is get the key 'C'
, gets the second list and then the third item of that list.
Then I suppose you would just do date = data
if that isn't a typo.
Upvotes: 4