0

I have a data I am reading into data={'data1':}
I am writing a lot of data to that key.

subData = {'1':1,'2':2,'3':3,'4':4,'5':5}
data['data1' = subData

When I have to open the data object again. how do I append more subdata to the key data1.

moreSubData = {'6':1,'7':2,'8':3,'9':4,'10':5}

I want to push moreSubData into the data['data1']

so the total data would be

`data['data1']` = {'1':1,'2':2,'3':3,'4':4,'5':5,'6':1,'7':2,'8':3,'9':4,'10':5}
newdeveloper
  • 534
  • 3
  • 17
  • Does this answer your question? [How do I merge two dictionaries in a single expression in Python?](https://stackoverflow.com/questions/38987/how-do-i-merge-two-dictionaries-in-a-single-expression-in-python) – JonSG Mar 24 '23 at 15:47
  • specifically `data['data1'] = {**data['data1'], **moreSubData}` should work for you – JonSG Mar 24 '23 at 15:48

0 Answers0