{ "cells": [ { "cell_type": "markdown", "id": "86c59eaa-b1fd-47f3-aa0d-3ad3626df3bf", "metadata": {}, "source": [ "# 中医体质管理" ] }, { "cell_type": "markdown", "id": "e791846d-699f-4803-b898-bda8f1a30dd2", "metadata": {}, "source": [ "## 中医体质数据管理" ] }, { "cell_type": "markdown", "id": "19cd094e-8228-4f21-9897-9e8bef990d4e", "metadata": {}, "source": [ "### 体质监测数据生成" ] }, { "cell_type": "code", "execution_count": 9, "id": "1f58bd08-d20b-4a76-a841-ac7e132a54b7", "metadata": { "execution": { "iopub.execute_input": "2022-08-05T05:39:03.670486Z", "iopub.status.busy": "2022-08-05T05:39:03.669966Z", "iopub.status.idle": "2022-08-05T05:39:03.705022Z", "shell.execute_reply": "2022-08-05T05:39:03.703508Z", "shell.execute_reply.started": "2022-08-05T05:39:03.670438Z" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ok\n" ] } ], "source": [ "import re\n", "import json\n", "\n", "file_name = 'data/132.txt'\n", "list1 =[]\n", "dict1 = {}\n", "with open(file_name,'r') as fl:\n", " for l in fl:\n", " list2 = []\n", " l = re.sub('[\\r\\n\\f ]{1,}', '', l)\n", " list2 = l.split(',')\n", " if list2[0] != '' and list2[5] != '':\n", " dict1[list2[0]] = [list2[1],list2[2],list2[3],list2[4],list2[5]+list2[6]]\n", "filename = 'data/132中医体质.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict1, fl) \n", "print('ok')" ] }, { "cell_type": "code", "execution_count": null, "id": "400f6c4b-8a67-4872-a912-a0aad86e923c", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }