{"id":113187,"date":"2026-10-05T17:57:29","date_gmt":"2026-10-05T09:57:29","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/113187.html"},"modified":"2026-10-05T17:57:29","modified_gmt":"2026-10-05T09:57:29","slug":"python%e5%9f%ba%e4%ba%8e%e5%85%b3%e9%94%ae%e8%af%8d%e5%88%86%e6%8b%a3%e5%bf%ab%e9%80%92%ef%bc%88%e9%80%82%e7%94%a8%e4%ba%8e%e7%94%b5%e5%95%86%e4%b8%8e%e8%b4%a7%e8%bf%90%e4%bb%a3%e7%90%86%e7%ad%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/113187.html","title":{"rendered":"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09"},"content":{"rendered":"<p>\u57fa\u4e8e\u201c\u5173\u952e\u8bcd\u89c4\u5219\u201d\u5206\u62e3\u5feb\u9012\u3002\u6839\u636e\u7269\u54c1\u63cf\u8ff0\u5339\u914d\u5173\u952e\u8bcd&#xff0c;\u8f93\u51fa\u7269\u6d41\u7c7b\u522b\u3001\u63a8\u8350\u8fd0\u8f93\u5de5\u5177\u3001\u6e29\u63a7\u8981\u6c42\u548c\u5907\u6ce8\u3002\u89c4\u5219\u53ef\u81ea\u884c\u589e\u5220\u3002<\/p>\n<p>\u00a0<\/p>\n<p>&#096;&#096;&#096;python<\/p>\n<p>import json<\/p>\n<p>from dataclasses import dataclass<\/p>\n<p>from typing import List, Dict<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>&#064;dataclass<\/p>\n<p>class Rule:<\/p>\n<p>\u00a0 \u00a0 category: str # \u7269\u6d41\u7c7b\u522b<\/p>\n<p>\u00a0 \u00a0 transport: List[str] # \u63a8\u8350\u8fd0\u8f93\u5de5\u5177<\/p>\n<p>\u00a0 \u00a0 keywords: List[str] # \u5339\u914d\u5173\u952e\u8bcd<\/p>\n<p>\u00a0 \u00a0 temperature: str &#061; &#034;\u5e38\u6e29&#034; # \u6e29\u63a7\u8981\u6c42<\/p>\n<p>\u00a0 \u00a0 priority: int &#061; 0 # \u4f18\u5148\u7ea7&#xff0c;\u8d8a\u5927\u8d8a\u4f18\u5148<\/p>\n<p>\u00a0 \u00a0 note: str &#061; &#034;&#034; # \u5907\u6ce8<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p># \u5206\u62e3\u89c4\u5219\u8868&#xff1a;\u53ef\u81ea\u884c\u6269\u5c55<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>RULES: List[Rule] &#061; [<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u5371\u9669\u54c1\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u5371\u9669\u54c1\u4e13\u7528\u8f66&#034;, &#034;\u5371\u9669\u54c1\u822a\u7a7a&#xff08;\u9700\u8d44\u8d28&#xff09;&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[&#034;\u7535\u6c60&#034;, &#034;\u9502\u7535\u6c60&#034;, &#034;\u9152\u7cbe&#034;, &#034;\u6c7d\u6cb9&#034;, &#034;\u6cb9\u6f06&#034;, &#034;\u70df\u82b1&#034;, &#034;\u6253\u706b\u673a&#034;, &#034;\u6613\u71c3&#034;, &#034;\u8150\u8680&#034;, &#034;\u6bd2\u6027&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u6309MSDS\u8981\u6c42&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;100,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u9700\u5371\u9669\u54c1\u8d44\u8d28&#xff0c;\u7981\u6b62\u666e\u901a\u5feb\u9012&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u6d3b\u4f53\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u6052\u6e29\u6d3b\u4f53\u8fd0\u8f93\u8f66&#034;, &#034;\u822a\u7a7a\u6d3b\u4f53\u8231&#034;, &#034;\u51b7\u85cf\u8f66&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[&#034;\u6d3b\u9e21&#034;, &#034;\u6d3b\u9e2d&#034;, &#034;\u6d3b\u9c7c&#034;, &#034;\u6d3b\u867e&#034;, &#034;\u6d3b\u4f53&#034;, &#034;\u5ba0\u7269&#034;, &#034;\u79cd\u82d7&#034;, &#034;\u6d3b\u79bd&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u6309\u52a8\u7269\u8981\u6c42&#xff0c;\u5982\u6d3b\u79bd15-25\u00b0C&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;90,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u9700\u68c0\u75ab\u8bc1\u660e\u3001\u901a\u98ce\u4f9b\u6c27&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u51b7\u94fe\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u51b7\u85cf\u8f66&#034;, &#034;\u51b7\u94fe\u822a\u7a7a&#034;, &#034;\u51b7\u85cf\u96c6\u88c5\u7bb1&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;\u9e21&#034;, &#034;\u9e2d&#034;, &#034;\u9e45&#034;, &#034;\u732a&#034;, &#034;\u725b&#034;, &#034;\u7f8a&#034;, &#034;\u8089&#034;, &#034;\u9c7c&#034;, &#034;\u867e&#034;, &#034;\u87f9&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;\u6d77\u9c9c&#034;, &#034;\u51bb\u54c1&#034;, &#034;\u51b7\u51bb&#034;, &#034;\u751f\u9c9c&#034;, &#034;\u51b0\u9c9c&#034;, &#034;\u96ea\u7cd5&#034;, &#034;\u51b0\u6dc7\u6dcb&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;\u75ab\u82d7&#034;, &#034;\u80f0\u5c9b\u7d20&#034;, &#034;\u8840\u6db2&#034;, &#034;\u836f\u54c1&#034;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 ],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u51b7\u51bb-18\u00b0C&#xff1b;\u51b7\u85cf0-4\u00b0C&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;80,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u5168\u7a0b\u6e29\u63a7\u8bb0\u5f55&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u8d35\u91cd\u54c1\/\u6587\u4ef6\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u4e13\u4eba\u62bc\u8fd0&#034;, &#034;\u822a\u7a7a\u4ef6&#034;, &#034;\u4fdd\u4ef7\u5feb\u9012&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[&#034;\u73e0\u5b9d&#034;, &#034;\u9ec4\u91d1&#034;, &#034;\u73b0\u91d1&#034;, &#034;\u540d\u8868&#034;, &#034;\u827a\u672f\u54c1&#034;, &#034;\u6587\u7269&#034;, &#034;\u91cd\u8981\u6587\u4ef6&#034;, &#034;\u8bc1\u4ef6&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u5e38\u6e29&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;70,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u4fdd\u4ef7\u3001\u7b7e\u6536\u9a8c\u8bc1&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u6613\u788e\u54c1\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u9646\u8fd0\u53a2\u5f0f\u8d27\u8f66&#034;, &#034;\u822a\u7a7a&#xff08;\u52a0\u56fa\u5305\u88c5&#xff09;&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[&#034;\u73bb\u7483&#034;, &#034;\u9676\u74f7&#034;, &#034;\u663e\u793a\u5668&#034;, &#034;\u5c4f\u5e55&#034;, &#034;\u706f\u5177&#034;, &#034;\u82b1\u74f6&#034;, &#034;\u955c\u5b50&#034;, &#034;\u6613\u788e&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u5e38\u6e29&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;60,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u9632\u9707\u3001\u9632\u538b&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u7535\u5b50\u4ea7\u54c1\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u9646\u8fd0&#034;, &#034;\u822a\u7a7a&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[&#034;\u624b\u673a&#034;, &#034;\u7535\u8111&#034;, &#034;\u82af\u7247&#034;, &#034;\u7535\u8def\u677f&#034;, &#034;\u76f8\u673a&#034;, &#034;\u65e0\u4eba\u673a&#034;, &#034;\u5bb6\u7535&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u5e38\u6e29\u9632\u6f6e&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;50,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u9632\u9759\u7535\u3001\u9632\u6f6e\u3001\u9632\u9707&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>\u00a0 \u00a0 Rule(<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 category&#061;&#034;\u666e\u901a\u5feb\u9012&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 transport&#061;[&#034;\u5feb\u9012\u8d27\u8f66&#034;, &#034;\u822a\u7a7a\u4ef6&#034;, &#034;\u94c1\u8def&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords&#061;[&#034;\u8863\u670d&#034;, &#034;\u978b&#034;, &#034;\u4e66&#034;, &#034;\u65e5\u7528\u54c1&#034;, &#034;\u73a9\u5177&#034;, &#034;\u98df\u54c1&#034;, &#034;\u96f6\u98df&#034;, &#034;\u5316\u5986\u54c1&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 temperature&#061;&#034;\u5e38\u6e29&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 priority&#061;10,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 note&#061;&#034;\u5e38\u89c4\u5305\u88c5&#034;<\/p>\n<p>\u00a0 \u00a0 ),<\/p>\n<p>]<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>def classify_express(text: str) -&gt; Dict:<\/p>\n<p>\u00a0 \u00a0 &#034;&#034;&#034;<\/p>\n<p>\u00a0 \u00a0 \u6839\u636e\u7269\u54c1\u63cf\u8ff0\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\u3002<\/p>\n<p>\u00a0 \u00a0 &#034;&#034;&#034;<\/p>\n<p>\u00a0 \u00a0 text &#061; text.strip()<\/p>\n<p>\u00a0 \u00a0 matched &#061; []<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 # 1. \u627e\u51fa\u6240\u6709\u547d\u4e2d\u7684\u89c4\u5219<\/p>\n<p>\u00a0 \u00a0 for rule in RULES:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 hits &#061; [kw for kw in rule.keywords if kw in text]<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 if hits:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 matched.append((rule, hits))<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 # 2. \u672a\u547d\u4e2d\u4efb\u4f55\u89c4\u5219<\/p>\n<p>\u00a0 \u00a0 if not matched:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 return {<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;input&#034;: text,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;matched_keywords&#034;: [],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;category&#034;: &#034;\u5f85\u4eba\u5de5\u5206\u62e3&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;transport&#034;: [&#034;\u4eba\u5de5\u786e\u8ba4&#034;],<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;temperature&#034;: &#034;\u672a\u77e5&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;priority&#034;: 0,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#034;note&#034;: &#034;\u672a\u547d\u4e2d\u89c4\u5219&#034;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 # 3. \u6309\u4f18\u5148\u7ea7\u6392\u5e8f&#xff0c;\u4f18\u5148\u7ea7\u6700\u9ad8\u7684\u4f5c\u4e3a\u4e3b\u89c4\u5219<\/p>\n<p>\u00a0 \u00a0 matched.sort(key&#061;lambda item: item[0].priority, reverse&#061;True)<\/p>\n<p>\u00a0 \u00a0 main_rule, main_hits &#061; matched[0]<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 categories, transports, keywords &#061; [], [], []<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 # 4. \u6c47\u603b\u6240\u6709\u547d\u4e2d\u7684\u7c7b\u522b\u3001\u8fd0\u8f93\u5de5\u5177\u3001\u5173\u952e\u8bcd<\/p>\n<p>\u00a0 \u00a0 for rule, hits in matched:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 if rule.category not in categories:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 categories.append(rule.category)<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 for t in rule.transport:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if t not in transports:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 transports.append(t)<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 keywords.extend(hits)<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 # \u53bb\u91cd\u5e76\u4fdd\u6301\u987a\u5e8f<\/p>\n<p>\u00a0 \u00a0 keywords &#061; list(dict.fromkeys(keywords))<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 return {<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;input&#034;: text,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;matched_keywords&#034;: keywords,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;category&#034;: &#034; &#043; &#034;.join(categories),<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;main_category&#034;: main_rule.category,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;transport&#034;: transports,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;temperature&#034;: main_rule.temperature,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;priority&#034;: main_rule.priority,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;note&#034;: main_rule.note<\/p>\n<p>\u00a0 \u00a0 }<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<\/p>\n<p>\u00a0 \u00a0 # \u6d4b\u8bd5\u793a\u4f8b<\/p>\n<p>\u00a0 \u00a0 test_items &#061; [<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u9e21&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u6d3b\u9e21&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u51b7\u51bb\u9e21\u817f&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u624b\u673a&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u9502\u7535\u6c60&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u73bb\u7483\u676f&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u91cd\u8981\u6587\u4ef6&#034;,<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 &#034;\u8863\u670d&#034;<\/p>\n<p>\u00a0 \u00a0 ]<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0 \u00a0 for item in test_items:<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 result &#061; classify_express(item)<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 print(json.dumps(result, ensure_ascii&#061;False, indent&#061;2))<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 print(&#034;-&#034; * 50)<\/p>\n<p>&#096;&#096;&#096;<\/p>\n<p>\u00a0<\/p>\n<p>\u793a\u4f8b\u8f93\u51fa\u4e2d\u7684\u5173\u952e\u90e8\u5206&#xff1a;<\/p>\n<p>\u00a0<\/p>\n<p>&#096;&#096;&#096;json<\/p>\n<p>{<\/p>\n<p>\u00a0 &#034;input&#034;: &#034;\u9e21&#034;,<\/p>\n<p>\u00a0 &#034;matched_keywords&#034;: [&#034;\u9e21&#034;],<\/p>\n<p>\u00a0 &#034;category&#034;: &#034;\u51b7\u94fe\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 &#034;main_category&#034;: &#034;\u51b7\u94fe\u8fd0\u8f93&#034;,<\/p>\n<p>\u00a0 &#034;transport&#034;: [&#034;\u51b7\u85cf\u8f66&#034;, &#034;\u51b7\u94fe\u822a\u7a7a&#034;, &#034;\u51b7\u85cf\u96c6\u88c5\u7bb1&#034;],<\/p>\n<p>\u00a0 &#034;temperature&#034;: &#034;\u51b7\u51bb-18\u00b0C&#xff1b;\u51b7\u85cf0-4\u00b0C&#034;,<\/p>\n<p>\u00a0 &#034;priority&#034;: 80,<\/p>\n<p>\u00a0 &#034;note&#034;: &#034;\u5168\u7a0b\u6e29\u63a7\u8bb0\u5f55&#034;<\/p>\n<p>}<\/p>\n<p>&#096;&#096;&#096;<\/p>\n<p>\u00a0<\/p>\n<p>\u5982\u679c\u8f93\u5165\u7684\u662f\u201c\u6d3b\u9e21\u201d&#xff0c;\u5219\u4f1a\u540c\u65f6\u547d\u4e2d\u201c\u6d3b\u4f53\u8fd0\u8f93\u201d\u548c\u201c\u51b7\u94fe\u8fd0\u8f93\u201d&#xff0c;\u4f46\u201c\u6d3b\u4f53\u8fd0\u8f93\u201d\u4f18\u5148\u7ea7\u66f4\u9ad8&#xff0c;\u56e0\u6b64\u4e3b\u7c7b\u522b\u4f1a\u662f\u6d3b\u4f53\u8fd0\u8f93\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u5b9e\u9645\u7269\u6d41\u4e2d&#xff0c;\u6d3b\u4f53\u3001\u51b7\u94fe\u3001\u5371\u9669\u54c1\u3001\u836f\u54c1\u7b49\u901a\u5e38\u6709\u4e25\u683c\u7684\u8d44\u8d28\u548c\u6cd5\u89c4\u8981\u6c42&#xff0c;\u8fd9\u6bb5\u4ee3\u7801\u9002\u5408\u505a\u89c4\u5219\u539f\u578b&#xff0c;\u751f\u4ea7\u73af\u5883\u5efa\u8bae\u63a5\u5165\u627f\u8fd0\u5546\u89c4\u5219\u5e93\u3001\u6e29\u63a7\u8bbe\u5907\u6570\u636e\u548c\u4eba\u5de5\u5ba1\u6838\u6d41\u7a0b\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u6587\u7ae0\u4ec5\u4f9b\u53c2\u8003\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u4e8e\u201c\u5173\u952e\u8bcd\u89c4\u5219\u201d\u5206\u62e3\u5feb\u9012\u3002\u6839\u636e\u7269\u54c1\u63cf\u8ff0\u5339\u914d\u5173\u952e\u8bcd&#xff0c;\u8f93\u51fa\u7269\u6d41\u7c7b\u522b\u3001\u63a8\u8350\u8fd0\u8f93\u5de5\u5177\u3001\u6e29\u63a7\u8981\u6c42\u548c\u5907\u6ce8\u3002\u89c4\u5219\u53ef\u81ea\u884c\u589e\u5220\u3002pythonimport jsonfrom dataclasses import dataclassfrom typing import List, Dictdataclassclass Rule:category: str # \u7269\u6d41\u7c7b\u522btransport: List[str] # \u63a8\u8350\u8fd0\u8f93\u5de5\u5177keywords: List[str] # \u5339\u914d\u5173\u952e\u8bcdte<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7175,890,495,81,190],"topic":[],"class_list":["post-113187","post","type-post","status-publish","format-standard","hentry","category-server","tag-virtualenv","tag-django","tag-pygame","tag-python","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/113187.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u57fa\u4e8e\u201c\u5173\u952e\u8bcd\u89c4\u5219\u201d\u5206\u62e3\u5feb\u9012\u3002\u6839\u636e\u7269\u54c1\u63cf\u8ff0\u5339\u914d\u5173\u952e\u8bcd&#xff0c;\u8f93\u51fa\u7269\u6d41\u7c7b\u522b\u3001\u63a8\u8350\u8fd0\u8f93\u5de5\u5177\u3001\u6e29\u63a7\u8981\u6c42\u548c\u5907\u6ce8\u3002\u89c4\u5219\u53ef\u81ea\u884c\u589e\u5220\u3002pythonimport jsonfrom dataclasses import dataclassfrom typing import List, Dictdataclassclass Rule:category: str # \u7269\u6d41\u7c7b\u522btransport: List[str] # \u63a8\u8350\u8fd0\u8f93\u5de5\u5177keywords: List[str] # \u5339\u914d\u5173\u952e\u8bcdte\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/113187.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-05T09:57:29+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113187.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/113187.html\",\"name\":\"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-05T09:57:29+00:00\",\"dateModified\":\"2026-10-05T09:57:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/113187.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/113187.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113187.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/113187.html","og_locale":"zh_CN","og_type":"article","og_title":"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u57fa\u4e8e\u201c\u5173\u952e\u8bcd\u89c4\u5219\u201d\u5206\u62e3\u5feb\u9012\u3002\u6839\u636e\u7269\u54c1\u63cf\u8ff0\u5339\u914d\u5173\u952e\u8bcd&#xff0c;\u8f93\u51fa\u7269\u6d41\u7c7b\u522b\u3001\u63a8\u8350\u8fd0\u8f93\u5de5\u5177\u3001\u6e29\u63a7\u8981\u6c42\u548c\u5907\u6ce8\u3002\u89c4\u5219\u53ef\u81ea\u884c\u589e\u5220\u3002pythonimport jsonfrom dataclasses import dataclassfrom typing import List, Dictdataclassclass Rule:category: str # \u7269\u6d41\u7c7b\u522btransport: List[str] # \u63a8\u8350\u8fd0\u8f93\u5de5\u5177keywords: List[str] # \u5339\u914d\u5173\u952e\u8bcdte","og_url":"https:\/\/www.wsisp.com\/helps\/113187.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-05T09:57:29+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/113187.html","url":"https:\/\/www.wsisp.com\/helps\/113187.html","name":"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-05T09:57:29+00:00","dateModified":"2026-10-05T09:57:29+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/113187.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/113187.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/113187.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Python\u57fa\u4e8e\u5173\u952e\u8bcd\u5206\u62e3\u5feb\u9012\uff08\u9002\u7528\u4e8e\u7535\u5546\u4e0e\u8d27\u8fd0\u4ee3\u7406\u7b49\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=113187"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113187\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=113187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=113187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=113187"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=113187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}