Append and Update json object python


import json

with open("knowledge.json", 'r') as f:
data = json.load(f)

data["worksbuddy.com"]["google.com"]["input"].append([3,4])
data["worksbuddy.com"]["google.com"]["output"].append(6)

with open('knowledge.json', 'w') as f:
f.write(json.dumps(data))



print(data)


Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.