**首先感谢 ***> [sfjdx][1]*** 大力支持** -------------------------------- 简单获取题目和答案,可以用来当做题库等 代码如下: ===== import json with open('1.json','r+',encoding='utf-8') as f: a=json.load(f) l=a['data']['questionBankList'] s='' for i in range(len(l)): # print(str(i+1)+'.'+l[i]['content']) b=l[i]['answerOptions'].split('@!@') s+=str(i+1)+'.'+l[i]['content']+'\n答案:'+l[i]['answer']+'.'+b[ord(l[i]['answer'])-65]+'\n\n'#显示题目序号和对应答案 with open('1.txt','w+',encoding='utf-8') as f: f.write(s) ---------- 效果如下 ---- ![屏幕截图 2020-12-05 221327.png][2] 代码为python,识别不太好 简单用到↓ --------------------- > json > with open > json.load > i循环 > split > \n 最后,写给自己 ------- Python 学习之路一直在路上,还是很多东西不会,还是感谢. [1]: https://futemly.top [2]: https://rnadow.top/usr/uploads/2020/12/461647635.png
评论