20221115
This commit is contained in:
1 parent
78a0714c22
commit
836a8235aa
1 file changed
+69
-3
+69
-3
@@ -10,12 +10,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "f6bc68b5-9ed8-4b28-ab1a-452107b6429a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-11-15T06:00:04.369411Z",
|
||||
"iopub.status.busy": "2022-11-15T06:00:04.368113Z",
|
||||
"iopub.status.idle": "2022-11-15T06:00:11.722290Z",
|
||||
"shell.execute_reply": "2022-11-15T06:00:11.719051Z",
|
||||
"shell.execute_reply.started": "2022-11-15T06:00:04.369149Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -185,6 +200,57 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9443f552-16a9-4c0d-82f8-279c42fa5e47",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 统计报告人员信息表"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "7a0a9111-2f2c-4c5d-bb5e-3e4fbd7ab1aa",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-11-15T06:21:40.662548Z",
|
||||
"iopub.status.busy": "2022-11-15T06:21:40.661365Z",
|
||||
"iopub.status.idle": "2022-11-15T06:21:40.862211Z",
|
||||
"shell.execute_reply": "2022-11-15T06:21:40.859943Z",
|
||||
"shell.execute_reply.started": "2022-11-15T06:21:40.662431Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"import os\n",
|
||||
"import glob\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员_2022.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"m_path = '../file/221103'\n",
|
||||
"fls = glob.glob(f'../file/221103/*.pdf')\n",
|
||||
"list1 = []\n",
|
||||
"for fn in fls:\n",
|
||||
" list2 = []\n",
|
||||
" code = os.path.basename(fn).split('.')[0]\n",
|
||||
" list2 = [code.rjust(5,\"0\"),dict1[code]['name'],dict1[code]['unit']]\n",
|
||||
" list1.append(list2)\n",
|
||||
"title = ['编号','姓名','部门'] \n",
|
||||
"filename = 'data/北海体测报告情况表.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row)\n",
|
||||
" \n",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "84325f89-1408-4d0a-b877-f4b54bcb22ce",
|
||||
@@ -432,7 +498,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user