From 83e5aa421836d9d004ae64cf98260d304d15e8db Mon Sep 17 00:00:00 2001 From: 512song <512song@sina.com> Date: Fri, 15 Sep 2023 09:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E4=BD=93=E6=B5=8B?= =?UTF-8?q?=E5=8D=95=E4=BD=8D/.ipynb=5Fcheckpoints/=E4=BD=93=E6=B5=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86-checkpoint.ipynb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../体测数据管理-checkpoint.ipynb | 166 ------------------ 1 file changed, 166 deletions(-) delete mode 100644 体测单位/.ipynb_checkpoints/体测数据管理-checkpoint.ipynb diff --git a/体测单位/.ipynb_checkpoints/体测数据管理-checkpoint.ipynb b/体测单位/.ipynb_checkpoints/体测数据管理-checkpoint.ipynb deleted file mode 100644 index 538dc1b..0000000 --- a/体测单位/.ipynb_checkpoints/体测数据管理-checkpoint.ipynb +++ /dev/null @@ -1,166 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "dcfbd41f-ca70-4f15-9153-60e6aaac27e8", - "metadata": {}, - "source": [ - "## 生成手机验证码" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "b68302b4-8fc1-4060-a10d-7f059f006f3c", - "metadata": { - "execution": { - "iopub.execute_input": "2023-07-11T11:45:00.310196Z", - "iopub.status.busy": "2023-07-11T11:45:00.309336Z", - "iopub.status.idle": "2023-07-11T11:45:00.344527Z", - "shell.execute_reply": "2023-07-11T11:45:00.343903Z", - "shell.execute_reply.started": "2023-07-11T11:45:00.310155Z" - }, - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "54\n" - ] - } - ], - "source": [ - "import openpyxl\n", - "import os,sys,shutil\n", - "import json\n", - "import math\n", - "import glob\n", - "import random\n", - "from pathlib import Path\n", - "import pymongo\n", - "\n", - "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", - "mydb = myclient[\"baogao\"]\n", - "\n", - "wb = openpyxl.load_workbook('data/北京石油分公司报告明细.xlsx')\n", - "place_id = 419309\n", - "dw_name = '北京石油分公司'\n", - "fi_path = 'file/2023-06-15'\n", - "fls = glob.glob(f'{fi_path}/*.pdf')\n", - "\n", - "code_list = []\n", - "for i in range(10): # 0~9\n", - " code_list.append(str(i))\n", - " \n", - "list1 = []\n", - "i = 0\n", - "while i < len(fls):\n", - " code = random.sample(code_list,6) #随机取6位数\n", - " code_num = ''.join(code)\n", - " if code_num not in list1:\n", - " list1.append(code_num)\n", - " i +=1\n", - "print(len(list1))\n", - "sheet = wb.active\n", - "# sheets = wb.sheetnames\n", - "list2 = []\n", - "i = 0\n", - "for n in range(2, sheet.max_row+1):\n", - " if sheet.cell(n,1).value is not None:\n", - " dict1 = {}\n", - " phone = str(sheet.cell(n, 3).value)\n", - " code = int(sheet.cell(n, 1).value)\n", - " yzm = list1[i]\n", - " i+=1\n", - " dict1 = {'place_id':place_id,'code':yzm,'fn':str(code)+'.pdf'}\n", - " list2.append(dict1)\n", - "mycol = mydb[\"pdf\"]\n", - "x = mycol.insert_many(list2)" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "a0a7cb45-4357-47a1-9094-e1500d072561", - "metadata": { - "execution": { - "iopub.execute_input": "2023-07-11T10:33:27.193601Z", - "iopub.status.busy": "2023-07-11T10:33:27.192748Z", - "iopub.status.idle": "2023-07-11T10:33:27.223006Z", - "shell.execute_reply": "2023-07-11T10:33:27.221929Z", - "shell.execute_reply.started": "2023-07-11T10:33:27.193559Z" - }, - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "54\n" - ] - } - ], - "source": [ - "import openpyxl\n", - "import os,sys,shutil\n", - "import json\n", - "import math\n", - "import glob\n", - "import random\n", - "from pathlib import Path\n", - "\n", - "wb = openpyxl.load_workbook('data/北京石油分公司报告明细.xlsx')\n", - "place_id = 1\n", - "dw_name = '北京石油分公司'\n", - "fi_path = 'file/2023-06-15'\n", - "fls = glob.glob(f'{fi_path}/*.pdf')\n", - "\n", - "code_list = []\n", - "for i in range(10): # 0~9\n", - " code_list.append(str(i))\n", - " \n", - "list1 = []\n", - "i = 0\n", - "while i < len(fls):\n", - " code = random.sample(code_list,6) #随机取6位数\n", - " code_num = ''.join(code)\n", - " if code_num not in list1:\n", - " list1.append(code_num)\n", - " i +=1\n", - "print(len(list1))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f3311070-2b8d-4442-b7da-025e48ee7bd3", - "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 -}