20250916
This commit is contained in:
1 parent
5bd40c3755
commit
689c26b967
7 files changed
+396
-116
No files matched your search
+61
-8
@@ -47,7 +47,7 @@
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['unit'] = '第二期'\n",
|
||||
" dict1['unit'] = '第三期'\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
|
||||
" dict1['id'] = sheet.cell(n, 5).value\n",
|
||||
" if sheet.cell(n,6).value is not None:\n",
|
||||
@@ -60,6 +60,59 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "a5cc3bda-6381-438c-822a-5b5a51771143",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-08-28T05:29:40.352838Z",
|
||||
"iopub.status.busy": "2025-08-28T05:29:40.352130Z",
|
||||
"iopub.status.idle": "2025-08-28T05:29:40.378000Z",
|
||||
"shell.execute_reply": "2025-08-28T05:29:40.377427Z",
|
||||
"shell.execute_reply.started": "2025-08-28T05:29:40.352773Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"46\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/海淀老干部局2025年秋季报名表.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, 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['unit'] = '2025年秋季'\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
|
||||
" dict1['id'] = sheet.cell(n, 5).value\n",
|
||||
" if sheet.cell(n,6).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n,6).value) \n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/海淀区老干部大学2025年秋季.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print(len(person))\n",
|
||||
"print('ok')\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "40f2c77d-1504-4288-9ed0-a0a4678579ee",
|
||||
@@ -70,15 +123,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 4,
|
||||
"id": "4e0de75e-6957-434a-9591-da96c21f4659",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-03-03T07:21:43.877959Z",
|
||||
"iopub.status.busy": "2025-03-03T07:21:43.877156Z",
|
||||
"iopub.status.idle": "2025-03-03T07:21:43.888327Z",
|
||||
"shell.execute_reply": "2025-03-03T07:21:43.887102Z",
|
||||
"shell.execute_reply.started": "2025-03-03T07:21:43.877887Z"
|
||||
"iopub.execute_input": "2025-08-28T05:29:44.681746Z",
|
||||
"iopub.status.busy": "2025-08-28T05:29:44.680983Z",
|
||||
"iopub.status.idle": "2025-08-28T05:29:44.691981Z",
|
||||
"shell.execute_reply": "2025-08-28T05:29:44.690831Z",
|
||||
"shell.execute_reply.started": "2025-08-28T05:29:44.681674Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -93,7 +146,7 @@
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/海淀区老干部大学第一期.json'\n",
|
||||
"filename = 'data/海淀区老干部大学2025年秋季.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
|
||||
Reference in new issue
Block a user