From 2ab2e986551434ab146e6ee0234dfb19e3052254 Mon Sep 17 00:00:00 2001 From: WangWeiye Date: Fri, 26 May 2023 15:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=88=86=E5=B9=B4=E7=BA=A7?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5=E4=B8=AD=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=97=A5=E6=9C=9Fbug=E5=B9=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=85=A8=E5=8D=B7=E8=87=AA=E5=8A=A8=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E9=A2=98=E5=8F=B7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../小闲平台作业测验数据导入_2023届.ipynb | 85 ++++--------------- 1 file changed, 18 insertions(+), 67 deletions(-) diff --git a/工具/分年级专用工具/小闲平台作业测验数据导入_2023届.ipynb b/工具/分年级专用工具/小闲平台作业测验数据导入_2023届.ipynb index 0a6f5b9e..0a452cfd 100644 --- a/工具/分年级专用工具/小闲平台作业测验数据导入_2023届.ipynb +++ b/工具/分年级专用工具/小闲平台作业测验数据导入_2023届.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -10,7 +10,7 @@ "import pandas as pd\n", "from pathlib import Path\n", "\n", - "#设置工作目录, 要求工作目录中恰有一个.tex文件和一个.zip文件,其余不论\n", + "#设置工作目录, 要求工作目录中恰有一些.tex(.txt)文件和一些.zip文件,对应的文件名需相同, 其余不论\n", "filepath = \"数据导入作业文件\"\n", "\n", "# date = str(time.localtime().tm_year)+str(time.localtime().tm_mon).zfill(2)+str(time.localtime().tm_mday).zfill(2)\n", @@ -29,6 +29,10 @@ " #生成文件名tex_file和zip_file\n", " zip_file, tex_file = fp\n", "\n", + " newdate = input(os.path.split(zip_file)[-1][:4]+\"使用日期(\"+date+\", 不变按回车, 要变化仅需输入最后几位改变的数字):\")\n", + " newdate = \"\".join(re.findall(r\"\\d\",newdate))\n", + " change_len = len(newdate)\n", + " date = date[:8-change_len]+newdate\n", "\n", " #获得题号数据,保存在problems_list中\n", " with open(tex_file,\"r\",encoding = \"utf8\") as f:\n", @@ -47,12 +51,20 @@ " extractedpath.rename(\"临时文件/statsfile.xlsx\")\n", " df = pd.read_excel(\"临时文件/statsfile.xlsx\")\n", " problems_indexes = list(df[df.columns[0]][2:])\n", + " autofill = False\n", " for p in problems_indexes:\n", - " t = input(os.path.split(zip_file)[-1][:4]+\"答题纸区域\"+p+\"的题号为(1-\"+str(len(problems_list))+\", a为自动对应点前的题号):\")\n", - " if t.upper() == \"A\":\n", + " if not autofill:\n", + " t = input(os.path.split(zip_file)[-1][:4]+\"答题纸区域\"+p+\"的题号为(1-\"+str(len(problems_list))+\", a为自动对应点前的题号, u为之后完全自动对应):\")\n", + " if t.upper() == \"A\":\n", + " correspondence_dict[p] = problems_list[int(re.findall(r\"([\\d]+?)\\.\",p)[0])-1]\n", + " elif t.upper() == \"U\":\n", + " correspondence_dict[p] = problems_list[int(re.findall(r\"([\\d]+?)\\.\",p)[0])-1]\n", + " autofill = True\n", + " elif not (int(t)<1 or int(t)>len(problems_list)):\n", + " correspondence_dict[p] = problems_list[int(t)-1]\n", + " else:\n", " correspondence_dict[p] = problems_list[int(re.findall(r\"([\\d]+?)\\.\",p)[0])-1]\n", - " elif not (int(t)<1 or int(t)>len(problems_list)):\n", - " correspondence_dict[p] = problems_list[int(t)-1] \n", + "\n", "\n", "\n", "\n", @@ -85,67 +97,6 @@ "zf.close()\n", "\n" ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "''" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "('数据导入作业文件', 'sj02.zip')" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "os.path.split(zip_file)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {