(1)首先以读取一个文件为例 import json json_text=r'.\2020-01-22_K1CaS7Qth660h.json' with open(json_text,encoding='utf8') as f: content = json.load(f) print(content) 输出读取的内容如下,为字典类型: (2)对rumor_weibo文件夹下的内容进行批量读取 2.将存入content_list中的内容写入excel r...
1importjson,xlwt2defreadExcel(file):3with open(file,'r',encoding='utf8') as fr:4data = json.load(fr)#用json中的load方法,将json串转换成字典5returndata6defwriteM():7a = readExcel('json')8print(a)9title = ["学号","姓名","语文成绩","数学成绩","英语成绩","总分","平均分"]10bo...
import json,xlwt def readExcel(file): with open(file,'r',encoding='utf8') as fr: data = json.load(fr) # 用json中的load方法,将json串转换成字典 return data def writeM(): a = readExcel('json') print(a) title = ["学号","姓名","语文成绩","数学成绩","英语成绩","总分","平均...