有一个json 文件存了一个List,这个时候读取这个json 文件最后转换为python 的List
代码如下:
import json as js
import os
jsonPath = "your personal path"
jsonfile = open(jsonPath)
yourList = js.load(jsonfile)
将一个list 写入python 的文件,代码如下
import json
with open(path,'w') as f:
json.dump(list,f)
# path 存放的是json 文件的路径