20241224
This commit is contained in:
1 parent
82372feb99
commit
c801f150ae
6 files changed
+1787
-626
No files matched your search
+127
-28
@@ -10,15 +10,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 29,
|
||||
"id": "3d5ddc7a-a331-438d-aa8d-1ad74c7250d0",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-06T11:58:52.021888Z",
|
||||
"iopub.status.busy": "2024-12-06T11:58:52.021240Z",
|
||||
"iopub.status.idle": "2024-12-06T11:58:52.246798Z",
|
||||
"shell.execute_reply": "2024-12-06T11:58:52.245884Z",
|
||||
"shell.execute_reply.started": "2024-12-06T11:58:52.021830Z"
|
||||
"iopub.execute_input": "2024-12-24T04:10:44.463102Z",
|
||||
"iopub.status.busy": "2024-12-24T04:10:44.462345Z",
|
||||
"iopub.status.idle": "2024-12-24T04:10:44.481670Z",
|
||||
"shell.execute_reply": "2024-12-24T04:10:44.480911Z",
|
||||
"shell.execute_reply.started": "2024-12-24T04:10:44.463032Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -55,6 +55,105 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"id": "7b218973-965d-4324-9553-d8e7ddfda4cd",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-24T14:48:29.843853Z",
|
||||
"iopub.status.busy": "2024-12-24T14:48:29.843106Z",
|
||||
"iopub.status.idle": "2024-12-24T14:48:29.865282Z",
|
||||
"shell.execute_reply": "2024-12-24T14:48:29.864798Z",
|
||||
"shell.execute_reply.started": "2024-12-24T14:48:29.843783Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/城东中心党委.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(3, sheet.max_row+1):\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0] \n",
|
||||
" dict1['unit'] = sheet.cell(n, 5).value\n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/新疆人员.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "e505049e-9bd9-4230-8074-93e37b82419c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成读卡系统文件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 38,
|
||||
"id": "3849dc10-8fd1-4acf-b9a7-872327456f6a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-24T14:48:31.958016Z",
|
||||
"iopub.status.busy": "2024-12-24T14:48:31.957269Z",
|
||||
"iopub.status.idle": "2024-12-24T14:48:31.967735Z",
|
||||
"shell.execute_reply": "2024-12-24T14:48:31.966636Z",
|
||||
"shell.execute_reply.started": "2024-12-24T14:48:31.957950Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/新疆人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" dict2 = {}\n",
|
||||
" #if dict1['sex'] =='男':\n",
|
||||
" # sex = 1\n",
|
||||
" \n",
|
||||
" dict2 = {'id':k,'name':v['name'],'gender':v['sex'],'birth':v['birth'],'unit':v['unit']}\n",
|
||||
" list1.append(dict2)\n",
|
||||
"json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n",
|
||||
"\n",
|
||||
"# 将 json 数据写入文件\n",
|
||||
"with open(\"data/card_新疆.json\", \"w\",encoding = 'utf-8') as file:\n",
|
||||
" file.write(json_data) \n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "faf346a5-3b0e-414e-ab64-dbde3b8c3dbd",
|
||||
@@ -65,15 +164,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 30,
|
||||
"id": "72ec680f-ec0d-44f9-919c-17c8e614b885",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-06T12:00:30.883983Z",
|
||||
"iopub.status.busy": "2024-12-06T12:00:30.883111Z",
|
||||
"iopub.status.idle": "2024-12-06T12:00:30.895148Z",
|
||||
"shell.execute_reply": "2024-12-06T12:00:30.894116Z",
|
||||
"shell.execute_reply.started": "2024-12-06T12:00:30.883907Z"
|
||||
"iopub.execute_input": "2024-12-24T04:10:51.916961Z",
|
||||
"iopub.status.busy": "2024-12-24T04:10:51.916210Z",
|
||||
"iopub.status.idle": "2024-12-24T04:10:51.929768Z",
|
||||
"shell.execute_reply": "2024-12-24T04:10:51.928679Z",
|
||||
"shell.execute_reply.started": "2024-12-24T04:10:51.916890Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -81,7 +180,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3\n"
|
||||
"1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -98,7 +197,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/marks_20241206.csv'\n",
|
||||
"filename = 'data/marks_20241224.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -149,15 +248,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 31,
|
||||
"id": "8f459ed3-fc14-404f-998b-5ed2a15958c3",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-06T12:04:22.231686Z",
|
||||
"iopub.status.busy": "2024-12-06T12:04:22.230937Z",
|
||||
"iopub.status.idle": "2024-12-06T12:04:22.249578Z",
|
||||
"shell.execute_reply": "2024-12-06T12:04:22.248603Z",
|
||||
"shell.execute_reply.started": "2024-12-06T12:04:22.231616Z"
|
||||
"iopub.execute_input": "2024-12-24T04:10:56.430593Z",
|
||||
"iopub.status.busy": "2024-12-24T04:10:56.429864Z",
|
||||
"iopub.status.idle": "2024-12-24T04:10:56.441856Z",
|
||||
"shell.execute_reply": "2024-12-24T04:10:56.440815Z",
|
||||
"shell.execute_reply.started": "2024-12-24T04:10:56.430526Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -215,15 +314,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 32,
|
||||
"id": "9e843585-fef3-4f5c-baae-76e711f2a42f",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-06T12:06:46.424162Z",
|
||||
"iopub.status.busy": "2024-12-06T12:06:46.422960Z",
|
||||
"iopub.status.idle": "2024-12-06T12:06:49.016373Z",
|
||||
"shell.execute_reply": "2024-12-06T12:06:49.015210Z",
|
||||
"shell.execute_reply.started": "2024-12-06T12:06:46.424089Z"
|
||||
"iopub.execute_input": "2024-12-24T04:10:59.919975Z",
|
||||
"iopub.status.busy": "2024-12-24T04:10:59.919307Z",
|
||||
"iopub.status.idle": "2024-12-24T04:11:00.529956Z",
|
||||
"shell.execute_reply": "2024-12-24T04:11:00.528814Z",
|
||||
"shell.execute_reply.started": "2024-12-24T04:10:59.919919Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -231,7 +330,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3\n"
|
||||
"1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -256,7 +355,7 @@
|
||||
" list1 = []\n",
|
||||
" mydata = {}\n",
|
||||
" \n",
|
||||
" id = str(k).rjust(4,\"0\")\n",
|
||||
" id = str(k).rjust(5,\"0\")\n",
|
||||
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||
" mydata['title'] = '新疆'\n",
|
||||
" mydata['subtitle'] = ''#v['unit']\n",
|
||||
|
||||
Reference in new issue
Block a user