I have a list of dictionary let's say : l=[{'a':1,'b':2},{'a':5,'b':6},{'a':3,'b':2}]
and I want to have another list l2 and add 4 to the 'a' in the all dictionaries
l2=[{'a':5,'b':2},{'a':9,'b':6},{'a':7,'b':2}]
(the first list l shouldn't change)
so I am doing it this way but i feel there is better, it is a bit hard coded I think :
l=[{'a':1,'b':2},{'a':5,'b':6},{'a':3,'b':2}]
l2=[d.copy() for d in l]
for v in l2:
v['a']=v['a']+4