This commit is contained in:
512song committed 2025-11-09 14:52:20 +08:00
1 parent b2ba8722fa
commit ac73cd8540
4 files changed
+275 -48

No files matched your search

+75 -14
View File
@@ -10,15 +10,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 18,
"id": "270e8c57-36d3-476c-8c50-4d8bc38a918a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-07T02:09:01.530591Z",
"iopub.status.busy": "2025-11-07T02:09:01.529883Z",
"iopub.status.idle": "2025-11-07T02:09:01.667299Z",
"shell.execute_reply": "2025-11-07T02:09:01.666813Z",
"shell.execute_reply.started": "2025-11-07T02:09:01.530529Z"
"iopub.execute_input": "2025-11-09T05:35:45.149501Z",
"iopub.status.busy": "2025-11-09T05:35:45.148976Z",
"iopub.status.idle": "2025-11-09T05:35:45.291101Z",
"shell.execute_reply": "2025-11-09T05:35:45.290596Z",
"shell.execute_reply.started": "2025-11-09T05:35:45.149453Z"
}
},
"outputs": [
@@ -26,7 +26,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1287 ok\n"
"1299 ok\n"
]
}
],
@@ -58,18 +58,26 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"id": "829d9460-a14e-4689-a7c4-d00bbd8c2e32",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-07T02:21:14.683211Z",
"iopub.status.busy": "2025-11-07T02:21:14.682609Z",
"iopub.status.idle": "2025-11-07T02:21:14.839810Z",
"shell.execute_reply": "2025-11-07T02:21:14.839319Z",
"shell.execute_reply.started": "2025-11-07T02:21:14.683158Z"
"iopub.execute_input": "2025-11-07T08:37:47.436725Z",
"iopub.status.busy": "2025-11-07T08:37:47.435955Z",
"iopub.status.idle": "2025-11-07T08:37:47.582958Z",
"shell.execute_reply": "2025-11-07T08:37:47.582377Z",
"shell.execute_reply.started": "2025-11-07T08:37:47.436655Z"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[['1553904', '孙建国', '物资采购中心'], ['1553904', '张巍', '应急救援中心']]\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
@@ -93,6 +101,7 @@
" if code in list2:\n",
" list4 = [code,sheet.cell(n, 4).value,sheet.cell(n, 3).value]\n",
" list3.append(list4)\n",
"print(list3)\n",
"filename = 'data/沧州炼化编号重复人员.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
@@ -110,6 +119,58 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 19,
"id": "7b6c8cb8-50ab-4b59-ac9a-6afb3db61476",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-09T05:35:48.182110Z",
"iopub.status.busy": "2025-11-09T05:35:48.181365Z",
"iopub.status.idle": "2025-11-09T05:35:48.197106Z",
"shell.execute_reply": "2025-11-09T05:35:48.196434Z",
"shell.execute_reply.started": "2025-11-09T05:35:48.182041Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1297 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(len(list1),'ok')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9148dcb7-ccaf-46f5-8390-ebe702ed4c02",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {