导出传智高校学习平台所有题库信息

  1. 打开浏览器开发者工具,选择Network的Fetch/XHR
  2. 刷新页面找到 https://stu.ityxb.com/back/bxg/my/busywork/findStudentBusywork?busyworkId=2a6803xxxxxx
      复制Response的所有内容
  3. 将Response的内容保存为json格式的文件
  4. 使用Python脚本读取json文件并以excel格式输出
import glob
import pandas as pd
import json
all_questions = []
for file_path in glob.glob('*.json'):
    print(file_path)
    with open(file_path, 'r', encoding='utf-8') as file:
        data = json.load(file)
        # 提取单选题数据
        for question in data['resultObject'].get('danxuan', {}).get('lists', []):
            question_text = question['questionContentText']
            options = [option['text'] for option in question['questionOptionList']]
            ans = question['answer']
            sul = question['solution']
            all_questions.append([question_text] + options + [ans] + [sul])

        # 提取多选题数据
        for question in data['resultObject'].get('duoxuan', {}).get('lists', []):
            question_text = question['questionContentText']
            options = [option['text'] for option in question['questionOptionList']]
            ans = question['answer']
            sul = question['solution']
            all_questions.append([question_text] + options + [ans] + [sul])

        # 提取判断题数据
        for question in data['resultObject'].get('panduan', {}).get('lists', []):
            question_text = question['questionContentText']
            options = [None, None, None, None]
            ans = question['answer']
            sul = question['solution']
            all_questions.append([question_text] + options + [ans] + [sul])
print(all_questions)
# 创建DataFrame
df = pd.DataFrame(all_questions, columns=['题干/小题题干', '选项A', '选项B', '选项C', '选项D','答案','解析'])

# 保存到Excel文件
df.to_excel('oneToFive.xlsx', index=False)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值