我有一个Json文件,如下所示:
{"user": ["file1","file2"],"user2": ["file1"]}
我想附加一个字典
{u'user2': [u'file2'],u'user3': [u'file1'], u'user4': [u'file1']}
放在json文件中,以便json文件看起来像
{"user": ["file1","file2"],"user2": ["file1", "file2"],"user3": ["file1"],"user4": ["file1"]}
根据我当前的方式
with open ('jsonfile', 'a+') as json_file :
json.dump(dictionary, json_file)
即时获取json文件,例如:
{"user": ["file1","file2"]}{"user2": ["file1", "file2"]}{"user3": ["file1"]}{"user4": ["file1"]}