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/工具/生成批改结果的手动输入文件.ipynb

130 lines
3.1 KiB
Plaintext
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.

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"usages\n",
"9531\n",
"20220913\t2023届高三2班\t0.903\n",
"\n",
"3013\n",
"20220913\t2023届高三2班\t0.452\n",
"\n",
"10196\n",
"20220913\t2023届高三2班\t0.774\n",
"\n",
"10192\n",
"20220913\t2023届高三2班\t0.097\n",
"\n",
"3648\n",
"20220913\t2023届高三2班\t0.742\t0.613\n",
"\n",
"555\n",
"20220913\t2023届高三2班\t0.226\n",
"\n",
"10197\n",
"20220913\t2023届高三2班\t0.484\n",
"\n",
"1227\n",
"20220913\t2023届高三2班\t0.968\t0.903\t0.839\t0.645\n",
"\n",
"884\n",
"20220913\t2023届高三2班\t0.806\n",
"\n",
"2975\n",
"20220913\t2023届高三2班\t0.484\n",
"\n",
"87\n",
"20220913\t2023届高三2班\t0.677\n",
"\n",
"1277\n",
"20220913\t2023届高三2班\t0.581\n",
"\n",
"4770\n",
"20220913\t2023届高三2班\t0.097\n",
"\n",
"\n"
]
}
],
"source": [
"import re\n",
"\n",
"#这里修改日期班级和excel中复制出来的数据\n",
"date = \"20220913\"\n",
"classname = \"2023届高三2班\"\n",
"data1 = \"\"\"\n",
"\n",
"\n",
"9531\t 0.903 \t\t\t\t\n",
"3013\t 0.452 \t\t\t\t\n",
"10196\t 0.774 \t\t\t\t\n",
"10192\t 0.097 \t\t\t\t\n",
"3648\t 0.742 \t 0.613 \t\t\t\n",
"555\t 0.226 \t\t\t\t\n",
"10197\t 0.484 \t\t\t\t\n",
"1227\t 0.968 \t 0.903 \t 0.839 \t 0.645 \t\n",
"884\t 0.806 \t\t\t\t\n",
"2975\t 0.484 \t\t\t\t\n",
"87\t 0.677 \t\t\t\t\n",
"1277\t 0.581 \t\t\t\t\n",
"4770\t 0.097 \t\t\t\t\n",
"\n",
"\n",
"\"\"\"\n",
"\n",
"outputstr = \"usages\\n\"\n",
"lines = [re.sub(r\"[\\s]+\",\"\\t\",line.strip()) for line in data1.split(\"\\n\") if line.strip() != \"\"]\n",
"for line in lines:\n",
" linedatalist = line.split(\"\\t\")\n",
" id = linedatalist.pop(0)\n",
" outputstr += id + \"\\n\"\n",
" outputstr += date + \"\\t\" + classname + \"\\t\" + \"\\t\".join([(\"%.3f\" %float(t)) for t in linedatalist]) + \"\\n\\n\"\n",
"print(outputstr)\n",
"with open(\"临时文件/批改结果.txt\",\"w\",encoding = \"utf8\") as f:\n",
" f.write(outputstr)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.8 ('base')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "d311ffef239beb3b8f3764271728f3972d7b090c974f8e972fcdeedf230299ac"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}