20230514
This commit is contained in:
1 parent
3c8e9c5157
commit
c7c9e34af4
4 files changed
+467
-105
No files matched your search
+208
-72
@@ -10,15 +10,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 189,
|
||||
"execution_count": 20,
|
||||
"id": "1b92b7c5-cb77-49da-95b7-34827ecf1d16",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-06T12:34:05.214342Z",
|
||||
"iopub.status.busy": "2023-05-06T12:34:05.213544Z",
|
||||
"iopub.status.idle": "2023-05-06T12:34:07.669288Z",
|
||||
"shell.execute_reply": "2023-05-06T12:34:07.668464Z",
|
||||
"shell.execute_reply.started": "2023-05-06T12:34:05.214303Z"
|
||||
"iopub.execute_input": "2023-05-14T14:13:07.924740Z",
|
||||
"iopub.status.busy": "2023-05-14T14:13:07.924333Z",
|
||||
"iopub.status.idle": "2023-05-14T14:13:10.350279Z",
|
||||
"shell.execute_reply": "2023-05-14T14:13:10.349499Z",
|
||||
"shell.execute_reply.started": "2023-05-14T14:13:07.924713Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -27,6 +27,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"8205\n",
|
||||
"8170\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
@@ -73,6 +75,12 @@
|
||||
" if sheet.cell(n,12).value is not None:\n",
|
||||
" dict1['工作性质'] = sheet.cell(n, 11).value\n",
|
||||
" person[code] = dict1\n",
|
||||
"jianyuan = [6484,7110,6441,6541,6543,6549,6555,6600,2958,2981,3033,3231,3249,3287,3228,7741,7749,7794,7799,7806,7837,7863,7870,7880,7894,7895,7904,7936,7947,7953,7958,7968,7969,7974,8086,8114]\n",
|
||||
"print(len(person))\n",
|
||||
"for k in jianyuan:\n",
|
||||
" if k in person.keys():\n",
|
||||
" del person[k]\n",
|
||||
"print(len(person))\n",
|
||||
"filename = 'data/燕山石化人员名单.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
@@ -89,15 +97,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 190,
|
||||
"execution_count": 14,
|
||||
"id": "71e1ec6a-6797-4496-969a-1d1461b9ea58",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-06T12:34:21.357836Z",
|
||||
"iopub.status.busy": "2023-05-06T12:34:21.356991Z",
|
||||
"iopub.status.idle": "2023-05-06T12:34:21.689244Z",
|
||||
"shell.execute_reply": "2023-05-06T12:34:21.688513Z",
|
||||
"shell.execute_reply.started": "2023-05-06T12:34:21.357796Z"
|
||||
"iopub.execute_input": "2023-05-13T02:04:57.276284Z",
|
||||
"iopub.status.busy": "2023-05-13T02:04:57.275446Z",
|
||||
"iopub.status.idle": "2023-05-13T02:04:57.669774Z",
|
||||
"shell.execute_reply": "2023-05-13T02:04:57.668967Z",
|
||||
"shell.execute_reply.started": "2023-05-13T02:04:57.276243Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -106,10 +114,9 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"399\n",
|
||||
"999 张术申 已测试!\n",
|
||||
"399\n",
|
||||
"5478\n"
|
||||
"252\n",
|
||||
"252\n",
|
||||
"7118\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -132,7 +139,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20230506.csv'\n",
|
||||
"filename = 'data/places_result_20230512.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -165,7 +172,7 @@
|
||||
" else:\n",
|
||||
" for k1,v1 in v.items():\n",
|
||||
" dict2[k][k1] = v1\n",
|
||||
"filename = 'data/result_燕山石化(20230506).json'\n",
|
||||
"filename = 'data/result_燕山石化(20230512).json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
"print(len(re_ta))\n",
|
||||
@@ -185,15 +192,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 191,
|
||||
"execution_count": 15,
|
||||
"id": "c24880ad-bbbd-4ad8-a894-cbcea389e822",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-06T12:36:51.312280Z",
|
||||
"iopub.status.busy": "2023-05-06T12:36:51.311429Z",
|
||||
"iopub.status.idle": "2023-05-06T12:36:51.482418Z",
|
||||
"shell.execute_reply": "2023-05-06T12:36:51.481718Z",
|
||||
"shell.execute_reply.started": "2023-05-06T12:36:51.312239Z"
|
||||
"iopub.execute_input": "2023-05-13T02:05:33.519879Z",
|
||||
"iopub.status.busy": "2023-05-13T02:05:33.519039Z",
|
||||
"iopub.status.idle": "2023-05-13T02:05:33.660778Z",
|
||||
"shell.execute_reply": "2023-05-13T02:05:33.660105Z",
|
||||
"shell.execute_reply.started": "2023-05-13T02:05:33.519838Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -205,7 +212,7 @@
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_燕山石化(20230506).json'\n",
|
||||
"filename = 'data/result_燕山石化(20230512).json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
@@ -230,7 +237,72 @@
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/燕山石化体测情况表(20230506).xlsx'\n",
|
||||
"filename = 'data/燕山石化体测情况表(20230512).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": "1cd93a0e-8340-4bd0-a8fd-747f149b256d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 总成绩导出"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 198,
|
||||
"id": "79c9c728-12e9-4107-bc5a-8c3e3d8b64a6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-08T00:52:23.460649Z",
|
||||
"iopub.status.busy": "2023-05-08T00:52:23.459824Z",
|
||||
"iopub.status.idle": "2023-05-08T00:52:25.090804Z",
|
||||
"shell.execute_reply": "2023-05-08T00:52:25.090044Z",
|
||||
"shell.execute_reply.started": "2023-05-08T00:52:23.460608Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_燕山石化.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/燕山石化人员名单.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(v['name']) \n",
|
||||
" list2.append(dict2[k]['sex'])\n",
|
||||
" list2.append(dict2[k]['工作单位']) \n",
|
||||
" list2.append(dict2[k]['车间'])\n",
|
||||
" list2.append(dict2[k]['班组'])\n",
|
||||
" for item in items:\n",
|
||||
" if item in v.keys():\n",
|
||||
" list2.append(v[item]['成绩']) \n",
|
||||
" elif item =='name':\n",
|
||||
" list2.append(v[item])\n",
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/燕山石化体测情况表(截至20230506).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -250,15 +322,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 161,
|
||||
"execution_count": 16,
|
||||
"id": "68454877-f1fe-4eed-8a48-265e428f892e",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-05T13:17:08.413642Z",
|
||||
"iopub.status.busy": "2023-05-05T13:17:08.412783Z",
|
||||
"iopub.status.idle": "2023-05-05T13:17:08.447423Z",
|
||||
"shell.execute_reply": "2023-05-05T13:17:08.446331Z",
|
||||
"shell.execute_reply.started": "2023-05-05T13:17:08.413601Z"
|
||||
"iopub.execute_input": "2023-05-13T02:05:45.816647Z",
|
||||
"iopub.status.busy": "2023-05-13T02:05:45.815801Z",
|
||||
"iopub.status.idle": "2023-05-13T02:05:45.845435Z",
|
||||
"shell.execute_reply": "2023-05-13T02:05:45.844361Z",
|
||||
"shell.execute_reply.started": "2023-05-13T02:05:45.816606Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -267,7 +339,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'储运厂工会': 216, '合成树脂厂': 93, '热电厂工会': 31, '合成橡胶厂工会': 34, '检验计量中心工会': 14, '化学品厂工会': 35, '烯烃厂工会': 9, '炼油厂工会': 40, '有机化工厂工会': 4, '机关工会': 2, '行政事务中心(离退中心)工会': 1, '物装中心工会': 1}\n"
|
||||
"{'合成橡胶厂工会': 55, '热电厂工会': 104, '检验计量中心工会': 58, '合成树脂厂': 2, '炼油厂工会': 26, '有机化工厂工会': 1, '高科公司工会': 1, '储运厂工会': 1, '化学品厂工会': 3, '烯烃厂工会': 1}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -275,7 +347,7 @@
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/result_燕山石化(20230505).json'\n",
|
||||
"filename = 'data/result_燕山石化(20230512).json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"dict2 = {}\n",
|
||||
@@ -290,7 +362,7 @@
|
||||
" list2 = []\n",
|
||||
" list2 = [k,v]\n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/燕山石化部门测试人数情况表(20230505).xlsx'\n",
|
||||
"filename = 'data/燕山石化部门测试人数情况表(20230512).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -367,15 +439,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 195,
|
||||
"execution_count": 23,
|
||||
"id": "eddf7dab-b28d-402a-aeaf-27c120048ecb",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-06T12:57:06.594280Z",
|
||||
"iopub.status.busy": "2023-05-06T12:57:06.593411Z",
|
||||
"iopub.status.idle": "2023-05-06T12:57:07.225472Z",
|
||||
"shell.execute_reply": "2023-05-06T12:57:07.224722Z",
|
||||
"shell.execute_reply.started": "2023-05-06T12:57:06.594240Z"
|
||||
"iopub.execute_input": "2023-05-14T14:17:34.734542Z",
|
||||
"iopub.status.busy": "2023-05-14T14:17:34.733685Z",
|
||||
"iopub.status.idle": "2023-05-14T14:17:34.966217Z",
|
||||
"shell.execute_reply": "2023-05-14T14:17:34.965520Z",
|
||||
"shell.execute_reply.started": "2023-05-14T14:17:34.734501Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -386,12 +458,12 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"title = ['编号','姓名','性别','单位','车间','班组']\n",
|
||||
"filename = 'data/result_燕山石化.json'\n",
|
||||
"filename = 'data/result_燕山石化-all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"# 筛选重名剔除名单\n",
|
||||
"chongming = []\n",
|
||||
"filename = 'data/燕山石化重名人员测试情况(20230506).xlsx'\n",
|
||||
"filename = 'data/燕山石化重名人员测试情况(20230512).xlsx'\n",
|
||||
"wb = openpyxl.load_workbook(filename)\n",
|
||||
"sheet = wb.active\n",
|
||||
"for n in range(1, sheet.max_row+1,2):\n",
|
||||
@@ -420,14 +492,13 @@
|
||||
" list2.append(dict2[k]['车间'])\n",
|
||||
" list2.append(dict2[k]['班组'])\n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/燕山石化未体测人员名单(截至20230506).xlsx'\n",
|
||||
"filename = 'data/燕山石化未体测人员名单(截至20230512).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) "
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -440,15 +511,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 188,
|
||||
"execution_count": 8,
|
||||
"id": "641863ef-324f-4c33-a0a9-699031afb6f1",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-06T04:49:09.959460Z",
|
||||
"iopub.status.busy": "2023-05-06T04:49:09.958827Z",
|
||||
"iopub.status.idle": "2023-05-06T04:49:10.100983Z",
|
||||
"shell.execute_reply": "2023-05-06T04:49:10.100011Z",
|
||||
"shell.execute_reply.started": "2023-05-06T04:49:09.959429Z"
|
||||
"iopub.execute_input": "2023-05-11T04:50:37.384699Z",
|
||||
"iopub.status.busy": "2023-05-11T04:50:37.383858Z",
|
||||
"iopub.status.idle": "2023-05-11T04:50:37.543557Z",
|
||||
"shell.execute_reply": "2023-05-11T04:50:37.542638Z",
|
||||
"shell.execute_reply.started": "2023-05-11T04:50:37.384657Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -457,7 +528,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[['4025', '马珺', '教育培训中心工会', '身高,体重,选择反应时'], ['7790', '吴志鹏', '生产运行保障中心', '身高,体重,握力'], ['2349', '王军海', '合成橡胶厂工会', '身高,体重'], ['8151', '赵春先', '合成树脂厂', '身高,体重,握力'], ['7682', '孙宏林', '有机化工厂工会', '肺活量,身高,体重'], ['2004', '刘鹏', '合成树脂厂', '身高,体重,握力'], ['642', '刘小宾', '储运厂工会', '身高,体重,肺活量'], ['3125', '李志斌', '化学品厂工会', '身高,体重,握力']]\n"
|
||||
"[['4025', '马珺', '教育培训中心工会', '身高,体重,选择反应时'], ['7790', '吴志鹏', '生产运行保障中心', '身高,体重,握力'], ['8151', '赵春先', '合成树脂厂', '身高,体重,握力'], ['7682', '孙宏林', '有机化工厂工会', '肺活量,身高,体重'], ['2004', '刘鹏', '合成树脂厂', '身高,体重,握力'], ['3125', '李志斌', '化学品厂工会', '身高,体重,握力']]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -467,7 +538,7 @@
|
||||
"\n",
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"filename = 'data/result_燕山石化.json'\n",
|
||||
"filename = 'data/result_燕山石化-all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
@@ -492,7 +563,7 @@
|
||||
" list2.append(xm)\n",
|
||||
" list1.append(list2)\n",
|
||||
"print(list1)\n",
|
||||
"filename = 'data/燕山石化测试项目不足人员(截止5月5日).xlsx'\n",
|
||||
"filename = 'data/燕山石化测试项目不足人员(截止5月11日).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"#sheet.append(title)\n",
|
||||
@@ -512,15 +583,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 142,
|
||||
"execution_count": 21,
|
||||
"id": "b735248a-c1b0-4e90-8df4-37cd7625cb1a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-27T11:19:41.635154Z",
|
||||
"iopub.status.busy": "2023-04-27T11:19:41.634745Z",
|
||||
"iopub.status.idle": "2023-04-27T11:19:41.975500Z",
|
||||
"shell.execute_reply": "2023-04-27T11:19:41.974722Z",
|
||||
"shell.execute_reply.started": "2023-04-27T11:19:41.635125Z"
|
||||
"iopub.execute_input": "2023-05-14T14:16:50.290820Z",
|
||||
"iopub.status.busy": "2023-05-14T14:16:50.290016Z",
|
||||
"iopub.status.idle": "2023-05-14T14:16:51.077768Z",
|
||||
"shell.execute_reply": "2023-05-14T14:16:51.076992Z",
|
||||
"shell.execute_reply.started": "2023-05-14T14:16:50.290789Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -529,8 +600,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3802\n",
|
||||
"3802\n"
|
||||
"7117\n",
|
||||
"7117\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -553,7 +624,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20230427-all.csv'\n",
|
||||
"filename = 'data/places_result_20230514.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -649,15 +720,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 194,
|
||||
"execution_count": 22,
|
||||
"id": "5df8eb8f-3594-40be-a491-b4d750bbd554",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-06T12:56:19.780009Z",
|
||||
"iopub.status.busy": "2023-05-06T12:56:19.779277Z",
|
||||
"iopub.status.idle": "2023-05-06T12:56:19.924293Z",
|
||||
"shell.execute_reply": "2023-05-06T12:56:19.923570Z",
|
||||
"shell.execute_reply.started": "2023-05-06T12:56:19.779982Z"
|
||||
"iopub.execute_input": "2023-05-14T14:17:09.067724Z",
|
||||
"iopub.status.busy": "2023-05-14T14:17:09.067317Z",
|
||||
"iopub.status.idle": "2023-05-14T14:17:09.226025Z",
|
||||
"shell.execute_reply": "2023-05-14T14:17:09.225328Z",
|
||||
"shell.execute_reply.started": "2023-05-14T14:17:09.067697Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -696,7 +767,7 @@
|
||||
" else:\n",
|
||||
" ce = '否'\n",
|
||||
" list3.append([code,name,unit,ce])\n",
|
||||
"filename = 'data/燕山石化重名人员测试情况(20230506).xlsx'\n",
|
||||
"filename = 'data/燕山石化重名人员测试情况(20230512).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"#sheet.append(title)\n",
|
||||
@@ -779,8 +850,73 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 217,
|
||||
"id": "c294db76-adc4-41bf-9ee6-811dde1905e8",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-09T02:59:10.544101Z",
|
||||
"iopub.status.busy": "2023-05-09T02:59:10.543244Z",
|
||||
"iopub.status.idle": "2023-05-09T02:59:10.550360Z",
|
||||
"shell.execute_reply": "2023-05-09T02:59:10.549157Z",
|
||||
"shell.execute_reply.started": "2023-05-09T02:59:10.544059Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"bs b'\\xc2\\xed\\xc1\\xa2\\xd1\\xc7'\n",
|
||||
"decode-bs: 马立亚\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#C2EDC1A2D1C7\n",
|
||||
"gbs = 'C2EDC1A2D1C7'\n",
|
||||
"import binascii\n",
|
||||
"bs = binascii.a2b_hex(gbs)\n",
|
||||
"print('bs', bs)\n",
|
||||
"print('decode-bs:', bs.decode('gb2312'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 219,
|
||||
"id": "9924d06a-8753-4856-9ccc-f3d5f8956bb2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-05-09T03:06:42.922674Z",
|
||||
"iopub.status.busy": "2023-05-09T03:06:42.921808Z",
|
||||
"iopub.status.idle": "2023-05-09T03:06:42.929473Z",
|
||||
"shell.execute_reply": "2023-05-09T03:06:42.928345Z",
|
||||
"shell.execute_reply.started": "2023-05-09T03:06:42.922633Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"gbcode: b'\\xc2\\xed\\xc1\\xa2\\xd1\\xc7'\n",
|
||||
"gbs: c2edc1a2d1c7\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"s = '马立亚'\n",
|
||||
"gbcode = s.encode('gb2312') # 先转成 bytes格式\n",
|
||||
"print('gbcode:', gbcode)\n",
|
||||
"gbs = \"\".join([hex(ch)[2:] for ch in gbcode]) #\n",
|
||||
"print('gbs:', gbs)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "930f3a2c-e39b-4d2c-916e-c99588e90274",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user