{
"example1": "bye",
"bye": "godbye"
}
import json
with open('tbl.json', encoding='utf-8') as f:
data = json.load(f)
data_write = data + {'bye': "godbye"}
with open('tbl.json', 'w', encoding='utf-8') as f:
json.dump(data_write, f, ensure_ascii=False, indent=4)
{
"example1": "bye"
}
unsupported operand type(s) for +: 'dict' and 'dict'
data.update({'bye': "godbye"})