diff --git a/体测单位/西藏.ipynb b/体测单位/西藏.ipynb new file mode 100644 index 0000000..bb3df9c --- /dev/null +++ b/体测单位/西藏.ipynb @@ -0,0 +1,98 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "70c15816-2ad5-4486-be33-378963d70934", + "metadata": {}, + "source": [ + "## 人员信息导入" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "07f7e97e-670e-4301-b83d-1304514f15d5", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-26T05:19:23.222114Z", + "iopub.status.busy": "2023-05-26T05:19:23.221226Z", + "iopub.status.idle": "2023-05-26T05:19:23.315408Z", + "shell.execute_reply": "2023-05-26T05:19:23.314480Z", + "shell.execute_reply.started": "2023-05-26T05:19:23.222072Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "\n", + "wb = openpyxl.load_workbook('data/健康体质检测人员名单(西藏销售).xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " if sheet.cell(n,1).value is not None:\n", + " code = int(sheet.cell(n, 1).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 2).value\n", + " if sheet.cell(n, 3).value ==1:\n", + " sex = '男'\n", + " else:\n", + " sex = '女'\n", + " dict1['sex'] = sex\n", + " birth = str(sheet.cell(n, 4).value).split()[0]\n", + " dict1['birth'] = birth\n", + " dict1['unit'] = sheet.cell(n, 6).value\n", + " if sheet.cell(n,5).value is not None:\n", + " dict1['phone'] = str(sheet.cell(n, 5).value) \n", + " person[code] = dict1\n", + "\n", + "filename = 'data/西藏销售人员名单.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print('ok')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "53ebce2b-2ff0-4617-ad56-293143b417a0", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.10.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}