我需要将字典值附加到已经存在的JSON文件中。我怎么能够 能够做到这一点?
我的details.json文件
{"name": "someName"}
我的python脚本生成的字典
list1 = {"name": "someOthername"}
with open("details.json") as r:
data = json.load(r)
desirableDict = data.append(list1) # It has to be something like this
print(desirableDict)
理想的输出: {“ name”:“ someName”,“ someOthername”}