{"id":10007045,"date":"2023-01-06T10:42:22","date_gmt":"2023-01-06T02:42:22","guid":{"rendered":"https:\/\/ityet.com\/?p=10007045"},"modified":"2023-01-06T10:42:22","modified_gmt":"2023-01-06T02:42:22","slug":"%e3%80%90%e5%9b%a2%e9%98%9f%e6%95%88%e7%8e%87%e6%8f%90%e5%8d%87%e3%80%91python-pywebio%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10007045","title":{"rendered":"\u3010\u56e2\u961f\u6548\u7387\u63d0\u5347\u3011Python-PyWebIO\u4ecb\u7ecd"},"content":{"rendered":"<h5>\u4f5c\u8005\uff1a\u4eac\u4e1c\u96f6\u552e \u5173\u952e<\/h5>\n<p><strong>Q&#038;A\u5feb\u901f\u4e86\u89e3PyWebIO<\/strong><\/p>\n<p><strong>Q<\/strong>\uff1a\u9996\u5148\uff0c\u4ec0\u4e48\u662f<strong>PyWebIO\uff1f<\/strong><\/p>\n<p><strong>A<\/strong>\uff1a<strong>PyWebIO<\/strong>\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u547d\u4ee4\u5f0f\u7684\u4ea4\u4e92\u51fd\u6570\uff0c\u80fd\u591f\u8ba9\u54b1\u4eec\u7528\u53ea\u7528Python\u5c31\u53ef\u4ee5\u7f16\u5199 Web \u5e94\u7528, \u4e0d\u9700\u8981\u7f16\u5199\u524d\u7aef\u9875\u9762\u548c\u540e\u7aef\u63a5\u53e3, \u8ba9\u7b80\u6613\u7684UI\u5f00\u53d1\u6548\u7387\u5927\u5927\u63d0\u9ad8\uff08\u672c\u4eba\u975e\u7814\u53d1\uff0c\u7528\u8bcd\u53ef\u80fd\u4e0d\u59a5\uff0c\u5927\u5bb6\u8f7b\u70b9\u55b7\uff09<\/p>\n<\/p>\n<p><strong>Q<\/strong>\uff1a\u5176\u6b21\uff0c\u6211\u4eec\u80fd\u7528\u6765\u5e72\u561b\uff1f\uff1f \u8fd9\u5bf9\u4e00\u4e2a\u56e2\u961f\u7684\u6548\u7387\u63d0\u5347\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f\uff1f<\/p>\n<p><strong>A<\/strong>\uff1a<strong>Pywebio<\/strong>\u7684\u4f5c\u7528\u5728\u4e8e\u8ba9\u54b1\u4eec\u53ef\u4ee5\u5feb\u901f\u7684\u5f00\u53d1\u4e00\u4e2a\u5e26\u6709UI\u754c\u9762\u7684\uff0c\u652f\u6301\u7528\u6237\u8f93\u5165\u7684\uff0c\u4ee5\u65e2\u5b9a\u7684\u903b\u8f91\u8f93\u51fa\u7ed3\u679c\u7684\u5e94\u7528\u3002 \u90a3\u4e48\uff0c\u6211\u4eec\u662f\u4e0d\u662f\u53ef\u4ee5\u5c06\u56e2\u961f\u5185\u4e00\u4e9b\u673a\u68b0\u6027\u7684\u6570\u636e\u5904\u7406\uff0c\u6570\u636e\u5f02\u52a8\u5206\u6790\u7b49\u7684\u5de5\u4f5c\u4ee5\u65e2\u5b9a\u903b\u8f91\u7684\u65b9\u5f0f\u901a\u8fc7Pywebio\u8f93\u51fa\u4e00\u4e2a\u53ef\u590d\u7528\u7684\u5e94\u7528\u7ed9\u5927\u5bb6\u4f7f\u7528\u5462\uff1f \u5f53\u7136\uff0c\u65e5\u5e38\u7684\u6570\u636e\u8fd0\u8425\u8fc7\u7a0b\u4e2d\uff0c\u54b1\u4eec\u80af\u5b9a\u4e0d\u662f\u9762\u5bf9\u7740\u4e00\u6210\u4e0d\u53d8\u7684case\u3002 \u90a3\u4e48\uff0c\u6211\u4eec\u662f\u4e0d\u662f\u53ef\u4ee5\u7528\u4e0d\u540c\u53c2\u6570\u8f93\u5165\u7684\u65b9\u5f0f\u6765\u8fbe\u5230\u4e00\u5b9a\u7684\u6cdb\u7528\u6027\u62d3\u5c55\u5462\uff1f \u53ea\u8981\uff0ccase\u548ccase\u4e4b\u95f4\u7684\u5e95\u5c42\u903b\u8f91\u662f\u4e00\u81f4\u7684\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u7528\u540c\u4e00\u5957\u903b\u8f91\uff0c\u4e0d\u540c\u7684\u5165\u53c2\u6765\u8fbe\u5230\u4e0d\u540c\u7ed3\u679c\u8f93\u51fa\u7684\u83b7\u53d6\u3002<\/p>\n<p><strong>Exampl<\/strong> \u5018\u82e5\uff0c\u6211\u4eec\u6bcf\u5929\u90fd\u6709\u4e00\u9879\u5de5\u4f5c\uff0c\u6bcf\u5929\u5bf9\u7740\u4e00\u4efd\u53c8\u4e00\u4efd\u4e1a\u52a1\u53cd\u9988\u7684\u8ba2\u5355\uff0c\u7136\u540e\u90e8\u95e8\u9700\u8981\u5bf9\u7740\u8fd9\u4e9b\u8ba2\u5355\u672c\u8eab\u8fdb\u884c\u4e00\u4e2a\u521d\u6b65\u7684\u98ce\u9669\u5206\u5c42\uff0c\u6211\u4eec\u662f\u4e0d\u662f\u53ef\u4ee5\u628a\u98ce\u9669\u5206\u5c42\u7684\u5e95\u5c42\u89c4\u5219\u5199\u5728\u540e\u7aef\uff0c\u7136\u540e\u901a\u8fc7PywebIO\u6765\u652f\u6301\u4e0d\u540c\u60c5\u51b5\u4e0b\u7684\u4e0d\u540c\u89c4\u5219\u9608\u503c\u8f93\u5165\uff0c \u5feb\u901f\u83b7\u53d6\u54b1\u4eec\u6240\u9700\u8981\u7684\u98ce\u9669\u5206\u5c42\u7ed3\u679c\u3002 \uff08\u5f53\u7136\uff0c\u5982\u679c\u6570\u636e\u5141\u8bb8\uff0c\u76f4\u63a5\u5199SQL\u4e5f\u53ef\u4ee5\uff0c\u53ef\u662f\uff0cSQL\u9700\u8981\u4e00\u5b9a\u7684\u95e8\u69db\uff0c\u800cPywebIO\u5219\u53ef\u4ee5\u901a\u8fc7UI\u7684\u65b9\u5f0f\u5206\u4eab\u7ed9\u90a3\u4e9b\u6ca1\u6709\u6280\u672f\u80cc\u666f\u7684\u8fd0\u8425\u4eba\u5458\u8fdb\u884c0\u4ee3\u7801\u4f7f\u7528\u3002\uff09<\/p>\n<\/p>\n<p>\u4ee5\u4e0b\u6b63\u5f0f\u5f00\u59cb\u7528\u4e00\u4e2a\u4f8b\u5b50\u6765\u9010\u6b65\u4ecb\u7ecdPywebIO\u62d3\u5c55\u5305<\/p>\n<h2><strong>\u7b80\u4ecb<\/strong><\/h2>\n<p>\u865a\u62df\u80cc\u666f\uff1a \u6bcf\u5929\u9700\u8981\u4e00\u4efd\u53c8\u4e00\u4efd\u5730\u5bf9\u4e1a\u52a1\u53cd\u9988\u7684\u6837\u672c\u6765\u8fdb\u884c\u98ce\u9669\u5206\u5c42\uff0c\u4e3a\u4e86\u63d0\u9ad8\u5904\u7406\u6548\u7387\u3002<\/p>\n<p>\u8ba1\u5212\u65b9\u6848\uff1a \u901a\u8fc7\u73b0\u6709\u98ce\u9669\u6807\u7b7e\u7684\u6ce2\u5c14\u6807\u7b7e\uff0c\u975e\u6ce2\u5c14\u6807\u7b7e\u4f53\u7cfb\u6765\u642d\u5efa\u4e00\u4e2a\u652f\u6301 \u7075\u6d3b\u914d\u7f6e\u9608\u503c\u6765\u5feb\u901f\u83b7\u53d6\u5206\u5c42\u7ed3\u679c\u7684UI\u5e94\u7528\u3002<\/p>\n<p>\u65b9\u6848\u7b80\u4ecb\uff1a\u57fa\u672c\u903b\u8f91\u5982\u4e0b\uff0c\uff08\u4ee5\u4e0b\u5747\u4e3a\u4e3e\u4f8b\u6240\u793a\uff0c\u5e76\u4e0d\u4ee3\u8868\u8be5\u65b9\u6848\u5c31\u53ef\u4ee5\u8fdb\u884c\u98ce\u9669\u5206\u5c42\u54c8\uff0c\u5927\u5bb6\u8bf7\u6ce8\u610f\uff09<\/p>\n<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260268\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<\/p>\n<p>\u5f00\u59cb\u5b9e\u73b0\uff1a\u8fd9\u91cc\u7684\u4f8b\u5b50\u91c7\u53d6\u7684\u662f\u975e\u6570\u636e\u5e93\u6a21\u5f0f\uff0c\u652f\u6301\u7684\u662f\u4e0a\u4f20\u672c\u5730csv\uff0c\u7136\u540e\u8fdb\u884c\u9608\u503c\u914d\u7f6e\u3002<\/p>\n<h2><strong>Step one\uff1a\u672c\u5730\u6587\u4ef6\u4e0a\u4f20<\/strong><\/h2>\n<p>\u9996\u5148\uff0c\u80af\u5b9a\u662f\u5f97\u5148\u6587\u4ef6\u4e0a\u4f20\u7684\u4ee3\u7801\u3002<\/p>\n<pre><code>##\u4f8b\u5b50\u5982\u4e0b\uff1a\nimport pandas as pd\nfrom pywebio.input import *\nfrom pywebio import start_server\nfrom pywebio.output import *\nimport nest_asyncio\nimport numpy as np\nimport os\nimport time\n\nnest_asyncio.apply()\n\nimport pandas as pd\nfrom pywebio.input import *\nfrom pywebio import start_server\nfrom pywebio.output import *\nimport nest_asyncio\nimport numpy as np\nimport os\nimport time\n\nnest_asyncio.apply()\n\ndef read_csv():\n    put_markdown('# \u53ea\u652f\u6301pin') \n    put_markdown('\u529f\u80fd\u5982\u4e0b\uff1a')\n    put_markdown(&quot;&quot;&quot;\n- \u9009\u62e9\u4e0e\u7a0b\u5e8f\u518d**\u540c\u4e00\u6587\u4ef6\u5939**\u7684\u6587\u4ef6\n- \u8f93\u5165\u4f60\u5e0c\u671b\u5361\u7684\u98ce\u9669\u503c\u9608\u503c **\u4e0d\u8f93\u5165\u5219\u9ed8\u8ba4-10**\n- \u81ea\u52a8\u52a0\u8f7d\u89e3\u6790\u8f93\u51fa\u6781\u9ed1\u6807\u7b7e\u5360\u6bd4\u4ee5\u53ca\u660e\u7ec6\u6570\u636e\n- \u8bf7\u52fe\u9009\u4f60\u6240\u9700\u8981\u7684\u6807\u7b7e**\uff08\u4e0d\u52fe\u9009=\u5168\u9009\uff09**\uff0c\u7136\u540e\u70b9\u51fb\u63d0\u4ea4\u5373\u53ef\n    &quot;&quot;&quot;)\n\n    file = file_upload('\u53ea\u652f\u6301\u4e0a\u4f20\u8be5\u7a0b\u5e8f\u6240\u5728\u6587\u4ef6\u5939\u7684csv\u6587\u4ef6\u54e6', '.csv')\n\n    ## \u672c\u5730\u6587\u4ef6\n    \n    raw_data = pd.read_csv(os.getcwd() + &quot;\/&quot; + file['filename'], encoding='gbk')\n    put_html(raw_data.to_html())\n    \nif __name__ == '__main__':\n\n    start_server(read_csv, port=8081, debug=True, cdn=False, auto_open_webbrowser=True)<\/code><\/pre>\n<p>\u5141\u8bb8\u4ee3\u7801\u540e\uff0c\u56e0\u4e3a\u201d auto_open_webbrowser=True\u201c\uff0c\u6240\u4ee5\u81ea\u52a8\u5f39\u51fa\u4e00\u4e2aWebUI\uff0c\u5982\u4e0b\u5de6\u56fe\uff0c\u9009\u62e9\u4e0a\u4f20\u7684\u6587\u4ef6\uff0c\u5373\u53ef\u770b\u5230\u4e0b\u53f3\u56fe\u7684\u6587\u4ef6\u6570\u636e<\/p>\n<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260269\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p> \ud83d\udc49<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260270\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<\/p>\n<h2><strong>Step two\uff1a\u98ce\u9669\u503c\u5361\u63a7<\/strong><\/h2>\n<p>\u7b2c\u4e00\u6b65\u4e5f\u53ea\u662f\u4e0a\u4f20\u6587\u4ef6\uff0c\u5c55\u793a\u6587\u4ef6\uff0c\u8fd8\u6ca1\u8fbe\u5230\u54b1\u4eec\u7684\u76ee\u7684\u3002 \u6240\u4ee5\uff0c\u7b2c\u4e8c\u6b65\u5219\u662f\u9700\u8981\u5bf9\u4e0a\u4f20\u7684csv\u672c\u8eab\u8fdb\u884c\u6570\u636e\u5904\u7406\uff0c\u903b\u8f91\u5224\u65ad\u3002 \u8fd9\u91cc\u5176\u5b9e\u5f88\u597d\u7406\u89e3\uff0c\u5728step one \u4e2d\u5df2\u7ecf\u83b7\u53d6\u4e86\u4e0a\u4f20\u7684\u6587\u4ef6\u4e14\u8f6c\u6210dataframe\u4e86\u5bf9\u5427\uff0c\u90a3\u4e48\u5b9e\u9645\uff0c\u54b1\u4eec\u53ea\u9700\u8981\u6cbf\u7528\u54b1\u4eec\u719f\u6089\u7684pandans\u5bf9dataframe\u8fdb\u884c\u5904\u7406\u5373\u53ef\u3002<\/p>\n<pre><code>import pandas as pd\nfrom pywebio.input import *\nfrom pywebio import start_server\nfrom pywebio.output import *\nimport nest_asyncio\nimport numpy as np\nimport os\nimport time\n\nnest_asyncio.apply()\n\ndef \u914d\u7f6e\u89c4\u5219_\u98ce\u9669\u503c\u9608\u503c(df, user_risk, pp_risk=None):\n    \n    df_updated = df[(df['\u98ce\u9669\u503cA'] &gt;=user_risk)|((df['\u98ce\u9669\u503cB'] &gt;=pp_risk))]   \n\n    return df_updated\n\ndef read_csv():\n    put_markdown('# \u53ea\u652f\u6301pin') \n    put_markdown('\u529f\u80fd\u5982\u4e0b\uff1a')\n    put_markdown(&quot;&quot;&quot;\n- \u9009\u62e9\u4e0e\u7a0b\u5e8f\u518d**\u540c\u4e00\u6587\u4ef6\u5939**\u7684\u6587\u4ef6\n- \u8f93\u5165\u4f60\u5e0c\u671b\u5361\u7684\u98ce\u9669\u503c\u9608\u503c **\u4e0d\u8f93\u5165\u5219\u9ed8\u8ba4-10**\n- \u81ea\u52a8\u52a0\u8f7d\u89e3\u6790\u8f93\u51fa\u6781\u9ed1\u6807\u7b7e\u5360\u6bd4\u4ee5\u53ca\u660e\u7ec6\u6570\u636e\n- \u8bf7\u52fe\u9009\u4f60\u6240\u9700\u8981\u7684\u6807\u7b7e**\uff08\u4e0d\u52fe\u9009=\u5168\u9009\uff09**\uff0c\u7136\u540e\u70b9\u51fb\u63d0\u4ea4\u5373\u53ef\n    &quot;&quot;&quot;)\n\n    file = file_upload('\u53ea\u652f\u6301\u4e0a\u4f20\u8be5\u7a0b\u5e8f\u6240\u5728\u6587\u4ef6\u5939\u7684csv\u6587\u4ef6\u54e6', '.csv')\n\n    ## \u672c\u5730\u6587\u4ef6\n\n    data = []\n    raw_data = pd.read_csv(os.getcwd() + &quot;\/&quot; + file['filename'], encoding='gbk')\n    put_html(raw_data.to_html())\n\n## -------------------------- \u4e0b\u9762\u662f step two \u65b0\u589e\u7684\u4ee3\u7801 -------------------------- \n\n    risk_value = input_group(\n    &quot;risk_value&quot;,\n    [\n        input(&quot;\u98ce\u9669\u503cA(\u9ed8\u8ba4-10)\uff1f&quot;, name=&quot;user_risk&quot;, type=NUMBER),\n        input(&quot;\u98ce\u9669\u503cB(\u9ed8\u8ba4-10)\uff1f&quot;, name=&quot;pp_risk&quot;, type=NUMBER)\n    ],\n    )\n    \n    raw_data_upated = \u914d\u7f6e\u89c4\u5219_\u98ce\u9669\u503c\u9608\u503c(raw_data,risk_value['user_risk'], risk_value['pp_risk'])\n\n    table1 = raw_data_upated.groupby('\u6307\u6807').\u8d26\u53f7.count().reset_index()\n    table1['\u5360\u6bd4'] = table1.\u8d26\u53f7 \/ len(raw_data_upated.\u8d26\u53f7.unique()) * 100\n    table1.sort_values('\u5360\u6bd4', ascending=False, inplace=True)\n    put_html(table1.to_html())\n\n## -------------------------- \u4e0a\u9762\u662f step two \u65b0\u589e\u7684\u4ee3\u7801 -------------------------- \n    \nif __name__ == '__main__':\n\n    start_server(read_csv, port=8081, debug=True, cdn=False, auto_open_webbrowser=True)<\/code><\/pre>\n<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260271\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p> \ud83d\udc49<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260272\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<\/p>\n<h2><strong>Step Three: \u6807\u7b7e\u5361\u63a7<\/strong><\/h2>\n<p>\u4ece\u7b2c\u4e8c\u6b65\uff0c\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86\u98ce\u9669\u503c\u9608\u503c\u7684\u5361\u63a7\uff0c\u7136\u540e\u7b2c\u4e09\u6b65\u5c31\u662f\u6807\u7b7e\u7684\u9009\u53d6\u4e86\u3002\u4ece\u5bf9\u6807\u7b7e\u7684\u7406\u89e3\u548c\u5e94\u7528\u7ecf\u9a8c\u4ee5\u53ca\u7b2c\u4e8c\u6b65\u5f97\u5230\u7684\u6807\u7b7e\u5728\u6837\u672c\u4e2d\u7684\u5360\u6bd4\uff0c\u54b1\u4eec\u5c31\u53ef\u4ee5\u5feb\u901f\u7684\u77e5\u9053\uff0c\u8fd9\u4e2a\u6837\u672c\u91cc\u9762\u7684\u6807\u7b7e\u5206\u5e03\u5206\u522b\u662f\u4ec0\u4e48\u3002\u8fdb\u4e00\u6b65\u53ef\u4ee5\u901a\u8fc7\u6807\u7b7e\u7684\u9009\u53d6\u8fbe\u5230\u6700\u7ec8\u7b26\u5408\u6211\u4eec\u98ce\u9669\u5206\u5c42\u7ed3\u679c\u4e2d\u6709\u98ce\u9669\u7684\u90a3\u4e00\u90e8\u5206\u7684\u8f93\u51fa\u4e86<\/p>\n<pre><code>import pandas as pd\nfrom pywebio.input import *\nfrom pywebio import start_server\nfrom pywebio.output import *\nimport nest_asyncio\nimport numpy as np\nimport os\nimport time\n\nnest_asyncio.apply()\n\ndef \u914d\u7f6e\u89c4\u5219_\u98ce\u9669\u503c\u9608\u503c(df, user_risk, pp_risk=None):\n    \n    df_updated = df[(df['\u98ce\u9669\u503cA'] &gt;=user_risk)|((df['\u98ce\u9669\u503cB'] &gt;=pp_risk))]   \n\n    return df_updated\n\ndef read_csv():\n    put_markdown('# \u53ea\u652f\u6301pin') \n    put_markdown('\u529f\u80fd\u5982\u4e0b\uff1a')\n    put_markdown(&quot;&quot;&quot;\n- \u9009\u62e9\u4e0e\u7a0b\u5e8f\u518d**\u540c\u4e00\u6587\u4ef6\u5939**\u7684\u6587\u4ef6\n- \u8f93\u5165\u4f60\u5e0c\u671b\u5361\u7684\u98ce\u9669\u503c\u9608\u503c **\u4e0d\u8f93\u5165\u5219\u9ed8\u8ba4-10**\n- \u81ea\u52a8\u52a0\u8f7d\u89e3\u6790\u8f93\u51fa\u6781\u9ed1\u6807\u7b7e\u5360\u6bd4\u4ee5\u53ca\u660e\u7ec6\u6570\u636e\n- \u8bf7\u52fe\u9009\u4f60\u6240\u9700\u8981\u7684\u6807\u7b7e**\uff08\u4e0d\u52fe\u9009=\u5168\u9009\uff09**\uff0c\u7136\u540e\u70b9\u51fb\u63d0\u4ea4\u5373\u53ef\n    &quot;&quot;&quot;)\n\n    file = file_upload('\u53ea\u652f\u6301\u4e0a\u4f20\u8be5\u7a0b\u5e8f\u6240\u5728\u6587\u4ef6\u5939\u7684csv\u6587\u4ef6\u54e6', '.csv')\n\n    ## \u672c\u5730\u6587\u4ef6\n\n    data = []\n    raw_data = pd.read_csv(os.getcwd() + &quot;\/&quot; + file['filename'], encoding='gbk')\n    put_html(raw_data.to_html())\n\n    risk_value = input_group(\n    &quot;risk_value&quot;,\n    [\n        input(&quot;\u98ce\u9669\u503cA(\u9ed8\u8ba4-10)\uff1f&quot;, name=&quot;user_risk&quot;, type=NUMBER),\n        input(&quot;\u98ce\u9669\u503cB(\u9ed8\u8ba4-10)\uff1f&quot;, name=&quot;pp_risk&quot;, type=NUMBER)\n    ],\n    )\n    \n    raw_data_upated = \u914d\u7f6e\u89c4\u5219_\u98ce\u9669\u503c\u9608\u503c(raw_data,risk_value['user_risk'], risk_value['pp_risk'])\n    \n    \n    table1 = raw_data_upated.groupby('\u6307\u6807').\u8d26\u53f7.count().reset_index()\n    table1['\u5360\u6bd4'] = table1.\u8d26\u53f7 \/ len(raw_data_upated.\u8d26\u53f7.unique()) * 100\n    table1.sort_values('\u5360\u6bd4', ascending=False, inplace=True)\n    put_html(table1.to_html())\n    \n    ## -------------------------- \u4e0b\u9762\u662f step three \u65b0\u589e\u7684\u4ee3\u7801 -------------------------- \n    \n    set_list = raw_data_upated.\u6307\u6807.unique()\n    \n    list_save = checkbox(label='\u52fe\u9009\u4fdd\u7559\u7684\u6807\u7b7e\uff0c\u4e0d\u52fe\u9009=\u5168\u9009', options=set_list, inline=True)\n    if list_save == []:\n        list_save = set_list\n    else:\n        list_save = list_save\n    raw_data_upated = raw_data_upated[raw_data_upated.\u6307\u6807.isin(list_save)]\n    put_html(raw_data_upated.to_html())\n\n    def Save0():\n        put_markdown(&quot;You click Save button, Done&quot;).show()\n        raw_data_upated.to_excel(os.getcwd() + &quot;\/&quot; + '\u8f93\u51fa\u7684\u98ce\u9669\u660e\u7ec6.xlsx', index=False)\n        \n    put_markdown(&quot;find your file on \u7a0b\u5e8f\u540c\u7ea7\u6587\u4ef6\u5939\u4e0b\u7684 \u6587\u4ef6 \uff1a \u8f93\u51fa\u7684\u98ce\u9669\u660e\u7ec6.xlsx&quot;).show()\n    put_buttons(['\u4e0b\u8f7d\u6587\u4ef6&quot;\u5bf9\u5185\u4e0d\u5bf9\u5916\u8f93\u51fa\u660e\u7ec6.xlsx&quot;'], onclick=[Save0]).show()\n        \n    ## -------------------------- \u4e0a\u9762\u662f step three \u65b0\u589e\u7684\u4ee3\u7801 -------------------------- \n    \nif __name__ == '__main__':\n\n    start_server(read_csv, port=8081, debug=True, cdn=False, auto_open_webbrowser=True)<\/code><\/pre>\n<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260273\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\ud83d\udc49<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043260274\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<\/p>\n<h2><strong>\u603b\u7ed3<\/strong><\/h2>\n<p>\u8fd9\u91cc\u53ea\u662f\u4e3e\u4e86\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u4e00\u4e2a\u652f\u6301\u9608\u503c+\u6807\u7b7e\u5361\u63a7\uff0c\u5feb\u901f\u83b7\u53d6\u7b26\u5408\u8981\u6c42\u7684\u76ee\u6807\u7fa4\u4f53\u7684\u4f8b\u5b50\u3002 \u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u6846\u67b6\u7684\u62d3\u5c55\u8fd8\u6709\u5f88\u591a\u3002\u4f8b\u5982\uff1a<\/p>\n<p>1.\u76f4\u8fde\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u5e2e\u4f4f\u90a3\u4e9b\u4e0d\u4f1asql\u7684\u540c\u4e8b\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5feb\u901f\u83b7\u53d6\u4e1a\u52a1\u6570\u636e\u3002<\/p>\n<p>2.Pyinstaller\u5c01\u88c5\u6210\u672c\u5730\u7a0b\u5e8f\uff0c\u8131\u79bb\u4ee3\u7801\u73af\u5883\uff0c\u53ef\u4ee5\u5728\u4efb\u610f\u7535\u8111\uff0c\u4efb\u610f\u73af\u5883\u3002<\/p>\n<p>\u5e0c\u671b\u8fd9\u4e2a\u4f8b\u5b50\u53ef\u4ee5\u5e2e\u52a9\u5230\u5927\u5bb6\uff0c\u611f\u8c22\u5927\u5bb6\u7684\u8010\u5fc3\u8bfb\u53d6<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043260266\">https:\/\/segmentfault.com\/a\/1190000043260266<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u4eac\u4e1c\u96f6\u552e \u5173\u952e Q&#038;A\u5feb\u901f\u4e86\u89e3PyWebIO Q\uff1a\u9996\u5148\uff0c\u4ec0\u4e48\u662fPyWebIO\uff1f A\uff1aPyWeb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10007045","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10007045"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007045\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10007045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10007045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10007045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}