This commit is contained in:
512song committed 2023-04-24 11:53:09 +00:00
1 parent 95bf9fd7dc
commit 60cd4d2643
1 file changed
+29 -39
+29 -39
View File
@@ -317,27 +317,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-03-27T08:26:44.127401Z",
"iopub.status.busy": "2023-03-27T08:26:44.126615Z",
"iopub.status.idle": "2023-03-27T08:26:44.449281Z",
"shell.execute_reply": "2023-03-27T08:26:44.448510Z",
"shell.execute_reply.started": "2023-03-27T08:26:44.127370Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"{1: {'name': '范平', 'sex': 0, 'birth': '1966-04-17', 'phone': None, 'avatar_id': 1}, 2: {'name': '杨宝坤', 'sex': 0, 'birth': '1964-10-29', 'phone': None, 'avatar_id': 2}, 3: {'name': '殷允衡', 'sex': 0, 'birth': '1965-02-14', 'phone': None, 'avatar_id': 3}, 4: {'name': '王立群', 'sex': 0, 'birth': '1969-09-18', 'phone': None, 'avatar_id': 4}, 5: {'name': '崔晓丽', 'sex': 1, 'birth': '1968-01-29', 'phone': None, 'avatar_id': 5}, 6: {'name': '刘静戎', 'sex': 0, 'birth': '1970-09-07', 'phone': None, 'avatar_id': 6}, 7: {'name': '亓海军', 'sex': 0, 'birth': '1969-08-11', 'phone': None, 'avatar_id': 7}, 8: {'name': '曹文东', 'sex': 0, 'birth': '1968-09-17', 'phone': None, 'avatar_id': 8}, 9: {'name': '尤洪坤', 'sex': 0, 'birth': '1970-06-19', 'phone': None, 'avatar_id': 9}, 10: {'name': '王力', 'sex': 0, 'birth': '1973-10-11', 'phone': None, 'avatar_id': 10}, 11: {'name': '李海', 'sex': 0, 'birth': '1974-09-24', 'phone': None, 'avatar_id': 11}, 12: {'name': '颜世山', 'sex': 0, 'birth': '1970-07-18', 'phone': None, 'avatar_id': 12}, 13: {'name': '刘海涛', 'sex': 0, 'birth': '1969-10-14', 'phone': None, 'avatar_id': 13}, 14: {'name': '曹明柱', 'sex': 0, 'birth': '1971-03-03', 'phone': None, 'avatar_id': 14}, 15: {'name': '杨旸', 'sex': 1, 'birth': '1971-03-24', 'phone': None, 'avatar_id': 15}, 16: {'name': '尤林祥', 'sex': 0, 'birth': '1981-08-23', 'phone': None, 'avatar_id': 16}, 17: {'name': '路遥', 'sex': 0, 'birth': '1982-02-21', 'phone': None, 'avatar_id': 17}, 18: {'name': '庄磊', 'sex': 1, 'birth': '1983-08-04', 'phone': None, 'avatar_id': 18}, 19: {'name': '孙萍', 'sex': 1, 'birth': '1983-11-15', 'phone': None, 'avatar_id': 19}, 20: {'name': '张珂', 'sex': 0, 'birth': '1984-12-04', 'phone': None, 'avatar_id': 20}, 21: {'name': '李中为', 'sex': 0, 'birth': '1982-08-12', 'phone': None, 'avatar_id': 21}, 22: {'name': '刘振', 'sex': 0, 'birth': '1989-08-28', 'phone': None, 'avatar_id': 22}, 23: {'name': '王兴春', 'sex': 0, 'birth': '1965-11-03', 'phone': None, 'avatar_id': 23}, 24: {'name': '张淑云', 'sex': 1, 'birth': '1967-09-28', 'phone': None, 'avatar_id': 24}, 25: {'name': '赵泽深', 'sex': 0, 'birth': '1968-12-12', 'phone': None, 'avatar_id': 25}, 26: {'name': '宫萍', 'sex': 1, 'birth': '1973-03-03', 'phone': None, 'avatar_id': 26}, 27: {'name': '李旻旻', 'sex': 1, 'birth': '1971-08-08', 'phone': None, 'avatar_id': 27}, 28: {'name': '王冰洁', 'sex': 1, 'birth': '1971-07-17', 'phone': None, 'avatar_id': 28}, 29: {'name': '高慧军', 'sex': 1, 'birth': '1969-08-25', 'phone': None, 'avatar_id': 29}, 30: {'name': '张燕', 'sex': 1, 'birth': '1974-06-10', 'phone': None, 'avatar_id': 30}, 31: {'name': '王少卿', 'sex': 1, 'birth': '1974-02-04', 'phone': None, 'avatar_id': 31}, 32: {'name': '方敏', 'sex': 1, 'birth': '1978-04-04', 'phone': None, 'avatar_id': 32}, 33: {'name': '陈守奎', 'sex': 0, 'birth': '1964-04-13', 'phone': None, 'avatar_id': 33}, 34: {'name': '王述佳', 'sex': 0, 'birth': '1964-01-06', 'phone': None, 'avatar_id': 34}, 35: {'name': '赵光春', 'sex': 0, 'birth': '1972-01-27', 'phone': None, 'avatar_id': 35}, 36: {'name': '泮广智', 'sex': 0, 'birth': '1979-10-20', 'phone': None, 'avatar_id': 36}, 37: {'name': '朱盛辉', 'sex': 1, 'birth': '1978-01-15', 'phone': None, 'avatar_id': 37}, 38: {'name': '张明星', 'sex': 0, 'birth': '1979-09-21', 'phone': None, 'avatar_id': 38}, 39: {'name': '邢静', 'sex': 1, 'birth': '1974-04-23', 'phone': None, 'avatar_id': 39}, 40: {'name': '李荣', 'sex': 1, 'birth': '1982-07-17', 'phone': None, 'avatar_id': 40}, 41: {'name': '冯永力', 'sex': 1, 'birth': '1981-07-08', 'phone': None, 'avatar_id': 41}, 42: {'name': '张强', 'sex': 0, 'birth': '1962-10-13', 'phone': None, 'avatar_id': 42}, 43: {'name': '王玉泉', 'sex': 0, 'birth': '1963-12-11', 'phone': None, 'avatar_id': 43}, 44: {'name': '汪锋', 'sex': 0, 'birth': '1963-03-26', 'phone': None, 'avatar_id': 44}, 45: {'name': '曾庆辉', 'sex': 0, 'birth': '1963-12-15', 'phone': None, 'avatar_id': 45}, 46: {'name': '芦建成', 'sex': 0, 'birth': '1963-02-17', 'phone': None, 'avatar_id': 46}, 47: {'name': '秦波', 'sex': 0, 'birth': '1962-11-08', 'phone': None, 'avatar_id': 47}, 48: {'name': '孙健', 'sex': 0, 'birth': '1962-06-11', 'phone': None, 'avatar_id': 48}, 49: {'name': '郭文生', 'sex': 0, 'birth': '1962-03-04', 'phone': None, 'avatar_id': 49}, 50: {'name': '任骏', 'sex': 0, 'birth': '1963-04-29', 'phone': None, 'avatar_id': 50}, 51: {'name': '贾生伟', 'sex': 0, 'birth': '1964-05-23', 'phone': None, 'avatar_id': 51}, 52: {'name': '尹祚龙', 'sex': 0, 'birth': '1962-06-30', 'phone': None, 'avatar_id': 52}, 53: {'name': '田守亮', 'sex': 0, 'birth': '1962-09-24', 'phone': None, 'avatar_id': 53}, 54: {'name': '崔建友', 'sex': 0, 'birth': '1963-05-07', 'phone': None, 'avatar_id': 54}, 55: {'name': '宋玉强', 'sex': 0, 'birth': '1964-02-19', 'phone': None, 'avatar_id': 55}, 56: {'Line truncated
"ok!\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
@@ -375,23 +359,44 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### YALM文件读取" "### YALM文件读取转存JSON文件"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 5,
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-04-24T10:49:01.806558Z",
"iopub.status.busy": "2023-04-24T10:49:01.805728Z",
"iopub.status.idle": "2023-04-24T10:49:01.923255Z",
"shell.execute_reply": "2023-04-24T10:49:01.922357Z",
"shell.execute_reply.started": "2023-04-24T10:49:01.806518Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [ "source": [
"import yaml\n", "import yaml\n",
"import json\n",
"\n",
"filename = 'data/体质指标问卷.yaml'\n", "filename = 'data/体质指标问卷.yaml'\n",
"with open(filename, 'r', encoding='utf-8') as f:\n", "with open(filename, 'r', encoding='utf-8') as f:\n",
" result = yaml.load(f.read(), Loader=yaml.FullLoader)\n", " result = yaml.load(f.read(), Loader=yaml.FullLoader)\n",
"i = 1\n", "i = 1\n",
"print(result['pages'])" "#print(result)\n",
"filename = 'data/体质指标问卷.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(result, fl, ensure_ascii=False)\n",
"print('ok')"
] ]
}, },
{ {
@@ -403,26 +408,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 43, "execution_count": null,
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-03-11T10:45:13.254808Z",
"iopub.status.busy": "2023-03-11T10:45:13.254221Z",
"iopub.status.idle": "2023-03-11T10:45:13.364497Z",
"shell.execute_reply": "2023-03-11T10:45:13.362986Z",
"shell.execute_reply.started": "2023-03-11T10:45:13.254761Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"{1: ['完全不正确', '有点正确', '多数正确', '完全正确'], 2: ['从不', '极少', '偶尔', '经常', '频繁', '非常频繁', '每天'], 3: ['不符合', '有时符合', '常常符合', '总是符合'], 4: ['从不', '很少', '有时', '经常', '总是'], 5: ['非常不满意', '不满意', '一般', '满意', '非常满意'], 6: ['没有或很少时间(少于1天)', '一部分时间(1-2天)', '相当多时间(3-4天)', '绝大部分时间(5-7天)'], 7: ['从来没有这种感觉', '很少有这种感觉', '有时有这种感觉', '经常有这种感觉'], 8: ['完全不同意', '不同意', '同意', '完全同意'], 10: ['晚多了', '晚一点', '差不多', '早一点', '早多了']}\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import os,sys,shutil\n", "import os,sys,shutil\n",