import os,json f = 'D:\temp\userlist.json' f2 = 'D:\temp\userlist2.json' file = open(f,'rb') fj = json.load(file) file.close() fj['liu'].remove('liu.ad3') fj['liu'].append('liu.ad4') # print(fj['liuchao6']) fname = 'wangwu' fj[fname]=['eae'] # dict_new = {'zhangsan':['abc']} # fj.update(dict_new) jsonfile = json.dumps(fj) print(jsonfile) # print(jsonfile) with open(f2,'w') as fw: fw.write(jsonfile)