This repository has been archived on 2024-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
mathdeptv2/工具v2/收集使用记录.py

47 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

zipfilepath = r"D:\temp\222816958193777036586_基础赋能卷8_高三_数学.zip"
# zipfilepath = r"D:\temp\222817041862672707412_控江中学2023学年第一学期高一数学期末考试_高一_数学.zip"
date = "20240125"
threshold = 0.75 #设置最低提交人数比例
from database_tools import *
import zipfile,shutil
tempdir = "临时文件/zips"
statsfilename = "小题分_按学号数学.xlsx"
answersheetseekingpath = "../备课组"
try:
shutil.rmtree(tempdir)
os.mkdir(tempdir)
except:
pass
xiaoxianpid = ParseZipname(zipfilepath)
paperinfo = FindPaper(xiaoxianpid, answersheetseekingpath)
gradename = paperinfo[1]
idlist = paperinfo[2]
zf = zipfile.ZipFile(zipfilepath)
zf.extractall(tempdir) #解压zip文件中的所有内容到tempdir
# papertype = CheckPaperType(tempdir,statsfilename)
statsfilepathlist = FindFile(tempdir,statsfilename)
validcols,marks = generateColIndexandMarks(statsfilepathlist,statsfilename,paperinfo)
dfcurrent = pd.read_excel(os.path.join(statsfilepathlist[0],statsfilename))
correspondence_dict = generateIDtoUsageCorrespondence(idlist,validcols,dfcurrent.iloc[1,validcols])
output = CalculateUsages(statsfilepathlist,statsfilename,gradename,threshold,marks,correspondence_dict,validcols,date)
SaveTextFile(output,"文本文件/metadata.txt")
print("数据文件已输出至metadata.txt")