Reputation: 2112
Pseudo code:
data = []
data.append({'name': 'John', 'age': '37'})
data.append({'name': 'Joe', 'age': '25'})
Here I do some calculations and I want to update data[0], in order to get:
data[0] = {'name': 'John', 'age': '37', 'country': 'USA'}
How can I update that first index of list?
Upvotes: 0
Views: 83
Reputation: 12130
Like:
data[0]['country'] = 'USA' # if you want to set value of country only
or
data[0] = {'name': 'John', 'age': '37', 'country': 'USA'} # if you want to update whole dictionary
Upvotes: 7