存储json文件,逐条按行存储
with open('xxx.json', 'a+', encoding='utf8')as f:
json.dump(temp, f, ensure_ascii=False)
f.write('\n')
读取json文件,逐条按行读取
with open('xxx.json', 'r', encoding='utf8') as f: for temp in islice(f, 0, None): temp = json.loads(temp) print(temp['xxxx1']) print(temp['xxxx2'])