json按格式逐行输出到文件
Dict/Json输出文件中逐行显示需要的效果如下图,我有一个list of dicts,它在json.cn中显示如下,我需要它输出到文件也显示同样的格式,而非整个list是一行:方法:# 写入json对象import jsondataset = [{"a":1, "b":2, "c":3}, {"d":[1,2,3], "e":[2,3,4], "f":[3,4,5]}]with open("your_file_path", "w", encoding="utf8") as wo: js
原创
2020-11-15 10:19:32 ·
1901 阅读 ·
0 评论