{"id":98291,"date":"2022-03-07T14:46:11","date_gmt":"2022-03-07T06:46:11","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=98291"},"modified":"2022-03-07T14:46:37","modified_gmt":"2022-03-07T06:46:37","slug":"0c3044a246","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=98291","title":{"rendered":"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<p style=\"font-size: 16px; padding: 8px 10px; line-height: 26px; color: black; margin: 1em 4px; word-break: break-word; overflow-wrap: break-word; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: 0.05em;\"><span style=\"letter-spacing: 0.05em;\">\u7ee7\u6253\u6e38\u620f\u3001\u770b\u89c6\u9891\u7b49\u6478\u9c7c\u884c\u4e3a\u88ab\u76d1\u63a7\u540e\uff0c\u73b0\u5728\u6253\u5de5\u4eba\u79bb\u804c\u7684\u503e\u5411\u4e5f\u4f1a\u88ab\u76d1\u63a7\u3002\u6700\u8fd1<\/span><span style=\"letter-spacing: 0.05em;\">\u6709\u7f51\u53cb\u8868\u793a\uff0c\u6240\u5728\u4f01\u4e1a\u5b89\u88c5\u4e86\u884c\u4e3a\u611f\u77e5\u7cfb\u7edf\uff0c\u8be5\u7cfb\u7edf\u53ef\u4ee5\u63d0\u524d\u83b7\u77e5\u5458\u5de5\u8df3\u69fd\u5ff5\u5934\u3002<\/span><\/p>\n<section style=\"padding-right: 10px; padding-left: 10px; line-height: 1.6; word-break: break-word; overflow-wrap: break-word; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; letter-spacing: 0.05em; color: #595959;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\"><span style=\"letter-spacing: 0.05em;\">\u4e00\u65f6\u95f4\uff0c\u201c\u6253\u5de5\u4eba\u592a\u96be\u4e86\u201d\u201c\u6beb\u65e0\u9690\u79c1\u53ef\u8a00\u201d\u7684\u8ba8\u8bba\u5c42\u51fa\u4e0d\u7a77\u3002<\/span><\/p>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u6709\u4e9b\u5c0f\u4f19\u4f34\u5c31\u95ee\u4e86\uff1a\u8fd9\u79cd\u76d1\u63a7\u6280\u672f\u4e0a\u53ef\u884c\u5417\uff1f\u590d\u6742\u5417\uff1f\u4eca\u5929\u5c31\u5e26\u5927\u5bb6\u5c1d\u8bd5\u7528\u51e0\u884c Python \u4ee3\u7801\uff0c\u76d1\u63a7\u7535\u8111\u4e0a\u7684\u64cd\u4f5c\u3002<\/p>\n<h3 style=\"font-size: 20px; margin-top: 1.2em; margin-bottom: 1em; font-weight: bold; color: #35b378;\">\u76d1\u63a7\u952e\u76d8<\/h3>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u5982\u679c\u516c\u53f8\u5077\u5077\u5728\u6211\u4eec\u7684\u7535\u8111\u4e0a\u8fd0\u884c\u4e86\u4e00\u4e2a\u540e\u53f0\u8fdb\u7a0b\uff0c\u6765\u76d1\u63a7\u6211\u4eec\u7684\u952e\u76d8\u4e8b\u4ef6\uff0c\u6700\u7b80\u5355\u7684 python \u5199\u6cd5\u5927\u81f4\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0pynput\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0keyboard\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">on_press<\/span><span style=\"line-height: 26px;\">(key)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0print(<span style=\"color: #98c379; line-height: 26px;\">f'<span style=\"color: #e06c75; line-height: 26px;\">{key}<\/span>\u00a0:pushed'<\/span>)\n\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">on_release<\/span><span style=\"line-height: 26px;\">(key)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0key\u00a0==\u00a0keyboard.Key.esc:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">False<\/span>\n\n\n<span style=\"color: #c678dd; line-height: 26px;\">with<\/span>\u00a0keyboard.Listener(on_press=on_press,\u00a0on_release=on_release)\u00a0<span style=\"color: #c678dd; line-height: 26px;\">as<\/span>\u00a0lsn:\n\u00a0\u00a0\u00a0\u00a0lsn.join()\n\n<\/code><\/pre>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u968f\u610f\u6572\u51fb\u952e\u76d8\uff0c\u4f60\u5c31\u4f1a\u4ece\u63a7\u5236\u53f0\u770b\u5230\u8fd9\u6837\u7684\u8f93\u51fa\uff1a<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg\" title=\"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/3-1646635571.png\" alt=\"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\" \/><\/p>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u4ee3\u7801\u5185\u5bb9\u5c31\u662f\u4e24\u4e2a\u65b9\u6cd5\uff0c\u4e00\u4e2a\u662f\u76d1\u542c\u6309\u952e\u4e8b\u4ef6\uff0c\u53e6\u4e00\u4e2a\u662f\u76d1\u542c\u9000\u51fa\u4e8b\u4ef6\u2014\u2014\u6572\u51fb <code style=\"font-size: 14px; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #35b378;\">ESC<\/code> \u6309\u952e\u540e\u91ca\u653e\u5c31\u9000\u51fa\u4e86\u3002<\/p>\n<h3 style=\"font-size: 20px; margin-top: 1.2em; margin-bottom: 1em; font-weight: bold; color: #35b378;\">\u76d1\u63a7\u9f20\u6807<\/h3>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u5982\u679c\u8fd8\u8981\u76d1\u542c\u9f20\u6807\u4e8b\u4ef6\uff0c\u90a3\u4e48\u4e0a\u8fd9\u6bb5\u4ee3\u7801\u5c31\u884c\u4e86\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0pynput\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0mouse\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">on_click<\/span><span style=\"line-height: 26px;\">(x,\u00a0y,\u00a0button,\u00a0pressed)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0button\u00a0==\u00a0mouse.Button.left:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0print(<span style=\"color: #98c379; line-height: 26px;\">'left\u00a0was\u00a0pressed!'<\/span>)\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">elif<\/span>\u00a0button\u00a0==\u00a0mouse.Button.right:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0print(<span style=\"color: #98c379; line-height: 26px;\">'right\u00a0was\u00a0pressed!'<\/span>)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">False<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">else<\/span>:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0print(<span style=\"color: #98c379; line-height: 26px;\">'mid\u00a0was\u00a0pressed!'<\/span>)\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u5b9a\u4e49\u9f20\u6807\u76d1\u542c\u7ebf\u7a0b<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">with<\/span>\u00a0mouse.Listener(on_click=on_click)\u00a0<span style=\"color: #c678dd; line-height: 26px;\">as<\/span>\u00a0listener:\n\u00a0\u00a0\u00a0\u00a0listener.join()\n\n<\/code><\/pre>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u8fd9\u6bb5\u4ee3\u7801\u4e3b\u8981\u662f\u76d1\u542c\u9f20\u6807\u7684\u5de6\u53f3\u952e\u70b9\u51fb\u64cd\u4f5c\uff0c\u8fd0\u884c\u4e4b\u540e\u64cd\u4f5c\u9f20\u6807\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u63a7\u5236\u53f0\u6253\u5370\u5982\u4e0b\u7ed3\u679c\uff1a<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg\" title=\"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/5-1646635571.png\" alt=\"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\" \/><\/p>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u7ec6\u5fc3\u7684\u4f60\u4e00\u5b9a\u4f1a\u53d1\u73b0\uff0c\u6bcf\u6b21\u70b9\u51fb\u4e8b\u4ef6\uff0c\u90fd\u6253\u5370\u4e86\u4e24\u6b21\u3002\u8fd9\u662f\u56e0\u4e3a\u6309\u4e0b\u548c\u677e\u5f00\u90fd\u4f1a\u89e6\u53d1\u9f20\u6807\u4e8b\u4ef6\u3002<\/p>\n<h3 style=\"font-size: 20px; margin-top: 1.2em; margin-bottom: 1em; font-weight: bold; color: #35b378;\">\u8bb0\u5f55\u76d1\u63a7\u65e5\u5fd7<\/h3>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u952e\u76d8\u4e8b\u4ef6\u548c\u9f20\u6807\u4e8b\u4ef6\u90fd\u6709\u4e86\uff0c\u662f\u65f6\u5019\u5c06\u4e8c\u8005\u7ed3\u5408\u8d77\u6765\uff0c\u628a\u7528\u6237\u7684\u64cd\u4f5c\u8bb0\u5f55\u5230\u65e5\u5fd7\u4e86\u3002\u8fd9\u91cc\u6211\u4eec\u7528 loguru \u8fd9\u4e2a\u6a21\u5757\u6765\u8bb0\u5f55\u65e5\u5fd7\u3002<\/p>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u6574\u4e2a\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0pynput\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0keyboard,\u00a0mouse\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0loguru\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0logger\n<span style=\"color: #c678dd; line-height: 26px;\">from<\/span>\u00a0threading\u00a0<span style=\"color: #c678dd; line-height: 26px;\">import<\/span>\u00a0Thread\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u5b9a\u4e49\u65e5\u5fd7\u6587\u4ef6<\/span>\nlogger.add(<span style=\"color: #98c379; line-height: 26px;\">'moyu.log'<\/span>)\n\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">on_press<\/span><span style=\"line-height: 26px;\">(key)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0logger.debug(<span style=\"color: #98c379; line-height: 26px;\">f'<span style=\"color: #e06c75; line-height: 26px;\">{key}<\/span>\u00a0:pushed'<\/span>)\n\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">on_release<\/span><span style=\"line-height: 26px;\">(key)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0key\u00a0==\u00a0keyboard.Key.esc:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">False<\/span>\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u5b9a\u4e49\u952e\u76d8\u76d1\u542c\u7ebf\u7a0b<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">press_thread<\/span><span style=\"line-height: 26px;\">()<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">with<\/span>\u00a0keyboard.Listener(on_press=on_press,\u00a0on_release=on_release)\u00a0<span style=\"color: #c678dd; line-height: 26px;\">as<\/span>\u00a0lsn:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0lsn.join()\n\n\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">on_click<\/span><span style=\"line-height: 26px;\">(x,\u00a0y,\u00a0button,\u00a0pressed)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0button\u00a0==\u00a0mouse.Button.left:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0logger.debug(<span style=\"color: #98c379; line-height: 26px;\">'left\u00a0was\u00a0pressed!'<\/span>)\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">elif<\/span>\u00a0button\u00a0==\u00a0mouse.Button.right:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0logger.debug(<span style=\"color: #98c379; line-height: 26px;\">'right\u00a0was\u00a0pressed!'<\/span>)\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">else<\/span>:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">False<\/span>\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u5b9a\u4e49\u9f20\u6807\u76d1\u542c\u7ebf\u7a0b<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">click_thread<\/span><span style=\"line-height: 26px;\">()<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">with<\/span>\u00a0mouse.Listener(on_click=on_click)\u00a0<span style=\"color: #c678dd; line-height: 26px;\">as<\/span>\u00a0listener:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0listener.join()\n\n\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0__name__\u00a0==\u00a0<span style=\"color: #98c379; line-height: 26px;\">'__main__'<\/span>:\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u00a0\u8d77\u4e24\u4e2a\u7ebf\u7a0b\u5206\u522b\u76d1\u63a7\u952e\u76d8\u548c\u9f20\u6807<\/span>\n\u00a0\u00a0\u00a0\u00a0t1\u00a0=\u00a0Thread(target=press_thread())\n\u00a0\u00a0\u00a0\u00a0t2\u00a0=\u00a0Thread(target=click_thread())\n\u00a0\u00a0\u00a0\u00a0t1.start()\n\u00a0\u00a0\u00a0\u00a0t2.start()\n\n<\/code><\/pre>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u8fd0\u884c\u4e4b\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u5728\u540c\u7ea7\u76ee\u5f55\u4e0b\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d\uff0c\u770b\u5230\u8fd9\u6837\u7684\u5185\u5bb9\u4e86\uff1a<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg\" title=\"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/8-1646635571.png\" alt=\"\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\" \/><\/p>\n<h3 style=\"font-size: 20px; margin-top: 1.2em; margin-bottom: 1em; font-weight: bold; color: #35b378;\">\u603b\u7ed3<\/h3>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u672c\u6587\u4e3b\u8981\u901a\u8fc7 <code style=\"font-size: 14px; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #35b378;\">pynput<\/code> \u8fd9\u4e2a python \u6a21\u5757\uff0c\u6f14\u793a\u600e\u4e48\u8bb0\u5f55\u952e\u76d8\u548c\u9f20\u6807\u7684\u64cd\u4f5c\u3002\u8fd9\u51e0\u884c\u7b80\u5355\u7684\u4ee3\u7801\u5bf9\u4e8e\u7b80\u5355\u7684\u8f93\u5165\u76d1\u63a7\u662f\u53ef\u884c\u7684\uff0c\u4f46\u662f\u5bf9\u4e8e\u804a\u5929\u8bb0\u5f55\u4e4b\u7c7b\u7684\u590d\u6742\u8bed\u53e5\uff0c\u4f60\u8fd8\u9700\u8981\u9488\u5bf9\u65e5\u5fd7\u7528 NLTK \u8bed\u8a00\u5904\u7406\uff0c\u624d\u80fd\u590d\u539f\u4f60\u7684\u804a\u5929\u8bb0\u5f55\u3002<\/p>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u5f53\u7136\uff0c\u6211\u4eec\u8fd9\u91cc\u4ec5\u4ec5\u662f\u4ece\u6280\u672f\u4e0a\u8ba8\u8bba\u53ef\u884c\u6027\uff0c\u5404\u4f4d\u5207\u83ab\u505a\u6709\u635f\u522b\u4eba\u9690\u79c1\u7684\u4e8b\u60c5\u3002\u518d\u8bf4\u4e86\uff0c\u4ec5\u51ed\u8fd9\u4e2a\u4ee3\u7801\uff0c\u522b\u4eba\u4e00\u773c\u5c31\u4f1a\u53d1\u73b0\u6709\u7a0b\u5e8f\u5728\u8bb0\u5f55\u64cd\u4f5c\u2026\u2026<\/p>\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 1em 4px;\">\u83b7\u53d6\u6587\u4e2d\u76f8\u5173\u4ee3\u7801\uff0c\u8bf7\u5728\u516c\u4f17\u53f7\u56de\u590d\u5173\u952e\u5b57\uff1a<strong>\u76d1\u63a7<\/strong><\/p>\n<section style=\"margin-top: 25px; white-space: normal; margin-left: 8px; margin-right: 8px;\"><span style=\"font-size: 14px; color: #797baa;\">\u4f5c\u8005\uff1a\u95f2\u6b22<\/span><\/section>\n<section style=\"white-space: normal; margin-left: 8px; margin-right: 8px;\"><span style=\"font-size: 14px; color: #797baa;\">\u6765\u6e90\uff1aPython \u6280\u672f\u300cID: pythonall\u300d<\/span><\/section>\n<\/section>\n<section style=\"margin-top: 20px; caret-color: #000000; white-space: normal;\"><\/section>\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/_9A7hzXAXi1mBrSuDMT5EA<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u7ee7\u6253\u6e38\u620f\u3001\u770b\u89c6\u9891\u7b49\u6478\u9c7c\u884c\u4e3a\u88ab\u76d1\u63a7\u540e\uff0c\u73b0\u5728\u6253\u5de5\u4eba\u79bb\u804c\u7684\u503e\u5411\u4e5f\u4f1a\u88ab\u76d1\u63a7\u3002\u6700\u8fd1\u6709\u7f51\u53cb\u8868\u793a\uff0c\u6240\u5728\u4f01\u4e1a\u5b89\u88c5\u4e86\u884c\u4e3a\u611f\u77e5\u7cfb\u7edf &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=98291\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u7528 Python \u5199\u4e00\u4e2a\u7535\u8111\u76d1\u63a7\u7a0b\u5e8f\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[8],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/98291"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98291"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/98291\/revisions"}],"predecessor-version":[{"id":98298,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/98291\/revisions\/98298"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98291"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}