{"id":841,"date":"2025-04-18T00:00:10","date_gmt":"2025-04-17T16:00:10","guid":{"rendered":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/"},"modified":"2025-04-18T00:00:10","modified_gmt":"2025-04-17T16:00:10","slug":"%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/","title":{"rendered":"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09"},"content":{"rendered":"<div class=\"article_content clearfix\" id=\"article_content\">\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/kdoc_html_views-1a98987dfd.css\" rel=\"stylesheet\"\/>\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/ck_htmledit_views-704d5b9767.css\" rel=\"stylesheet\"\/>\n<div class=\"htmledit_views\" id=\"content_views\">\n<h5>\n   <strong><br \/>\n    \u8bfe\u7a0b\u4ecb\u7ecd<br \/>\n   <\/strong><br \/>\n  <\/h5>\n<p>\n   \u8bbe\u8ba1\u6a21\u5f0f\uff08Design Pattern\uff09\u662f\u4e00\u5957\u88ab\u53cd\u590d\u4f7f\u7528\u3001\u591a\u6570\u4eba\u77e5\u6653\u7684\u3001\u65e0\u6570\u5de5\u7a0b\u5e08\u5b9e\u8df5\u7684\u4ee3\u7801\u8bbe\u8ba1\u7ecf\u9a8c\u7684\u603b\u7ed3\uff0c\u5b83\u662f\u9762\u5411\u5bf9\u8c61\u601d\u60f3\u7684\u9ad8\u5ea6\u63d0\u70bc\u548c\u6a21\u677f\u5316\u3002\u4f7f\u7528\u8bbe\u8ba1\u6a21\u5f0f\u5c06\u4f1a\u8ba9\u4ee3\u7801\u5177\u6709\u66f4\u9ad8\u7684\u53ef\u91cd\u7528\u6027\u3001\u66f4\u597d\u7684\u7075\u6d3b\u6027\u548c\u53ef\u62d3\u5c55\u6027\u3001\u66f4\u5bb9\u6613\u9605\u8bfb\u548c\u7406\u89e3\u3002\n  <\/p>\n<p>\n   \u7a0b\u5e8f\u4e0d\u5e94\u53ea\u662f\u51b7\u51b0\u51b0\u7684\u4ee3\u7801\uff0c\u66f4\u5e94\u8d4b\u4e88\u5b83\u751f\u6d3b\u7684\u4e50\u8da3\u548c\u7279\u6b8a\u7684\u610f\u4e49\u3002\u672c\u8bfe\u7a0b\u5185\u5bb9\u5c06\u4f1a\u4ece\u751f\u6d3b\u7684\u89d2\u5ea6\uff0c\u5728\u751f\u6d3b\u7684\u6bcf\u4e00\u4e2a\u7ec6\u8282\u548c\u6545\u4e8b\u4e2d\u89e3\u8bfb\u4e00\u4e2a\u4e2a\u8bbe\u8ba1\u6a21\u5f0f\u3002<br \/>\n   <strong><br \/>\n    \u529b\u6c42\u7528\u66f4\u901a\u4fd7\u7684\u8bed\u8a00\u9610\u8ff0\u96be\u61c2\u7684\u6982\u5ff5\uff1b\u7528\u66f4\u7b80\u5355\u7684\u8bed\u6cd5\u5b9e\u73b0\u590d\u6742\u7684\u903b\u8f91\uff1b\u7528\u66f4\u77ed\u5c0f\u7684\u4ee3\u7801\u5199\u51fa\u5f3a\u608d\u7684\u7a0b\u5e8f\uff01<br \/>\n   <\/strong><br \/>\n   \u5e0c\u671b\u80fd\u5e26\u7ed9\u8bfb\u8005\u4e00\u79cd\u5168\u65b0\u7684\u9605\u8bfb\u4f53\u9a8c\u548c\u601d\u8003\u65b9\u5f0f\u3002\n  <\/p>\n<p>\n   \u534a\u5e74\u524d\uff0c\u53d1\u5e03\u4e86\u300a<br \/>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5a1c24de28554541fbc8f2e8\" rel=\"nofollow\"><br \/>\n    \u5982\u4f55\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n   <\/a><br \/>\n   \u300b\u4e00\u7cfb\u5217\u7684\u8bfe\u7a0b\uff0c\u6536\u6548\u8fd8\u4e0d\u9519\uff01\u8fd9\u4e00\u8bfe\u7a0b\u5171\u8ba1 11 \u7bc7\uff0c\u8bb2\u4e86\u5e38\u7528\u7684 10 \u79cd\u8bbe\u8ba1\u6a21\u5f0f\u3002\u5e94\u8bfb\u8005\u8981\u6c42\uff0c\u7ecf\u534a\u5e74\u7cbe\u5fc3\u51c6\u5907\u540e\u7ec8\u4e8e\u53ef\u4ee5\u628a\u5269\u4f59\u7684\u90a3\u4e9b\u8bbe\u8ba1\u6a21\u5f0f\u8865\u5145\u5b8c\u6574\uff0c\u5e76\u5bf9\u4e0a\u4e00\u671f\u7684\u5185\u5bb9\u505a\u4e86\u90e8\u5206\u4fee\u6b63\u548c\u5347\u7ea7\uff0c\u73b0\u5408\u96c6\u5728\u4e00\u8d77\u4f5c\u4e3a\u5347\u7ea7\u7248\uff0c\u539f\u6709\u8bfe\u7a0b\u4e0d\u518d\u552e\u5356\uff08\u8bfb\u8005\u82e5\u5df2\u8d2d\u4e70\uff0c\u4e0d\u5f71\u54cd\u9605\u8bfb\uff0c\u540c\u65f6\u82e5\u8d2d\u4e70\u65b0\u7684\u8bfe\u7a0b\u4f1a\u6709\u5f88\u5927\u7684\u4f18\u60e0\u3002\uff09\u3002\n  <\/p>\n<p>\n   \u6b64\u5347\u7ea7\u7248\u7684\u7cfb\u5217\u8bfe\u7a0b\u5206\u4e09\u90e8\u5206\u5185\u5bb9\uff1a\n  <\/p>\n<ul>\n<li>\n    \u57fa\u7840\u7bc7\uff08\u7b2c01~21\u8bfe\uff09\uff0c19 \u79cd\u5e38\u7528\u8bbe\u8ba1\u6a21\u5f0f\u5355\u72ec\u7ae0\u8282\u8bb2\u89e3 + \u5269\u4f59 4 \u79cd\u6a21\u5f0f\u5408\u96c6\uff08\u4f1a\u67091~2\u7bc7\u7684\u7bc7\u5e45\uff09\uff1b\n   <\/li>\n<li>\n    \u8fdb\u9636\u7bc7\uff08\u7b2c22~24\u8bfe\uff09\uff0c\u662f\u57fa\u7840\u8bbe\u8ba1\u6a21\u5f0f\u7684\u884d\u751f\uff0c\u4e5f\u662f\u5404\u5927\u7f16\u7a0b\u8bed\u8a00\u4e2d\u975e\u5e38\u91cd\u8981\u800c\u5e38\u89c1\u7684\u79cd\u7f16\u7a0b\u673a\u5236\uff1b\n   <\/li>\n<li>\n    \u7ecf\u9a8c\u7bc7\uff08\u7b2c25~27\u8bfe\uff09\uff0c\u5c06\u4f1a\u5206\u4eab\u6211\u5bf9\u8bbe\u8ba1\u539f\u5219\u3001\u8bbe\u8ba1\u6a21\u5f0f\u3001\u9879\u76ee\u91cd\u6784\u7684\u7ecf\u9a8c\u548c\u770b\u6cd5\u3002\n   <\/li>\n<\/ul>\n<p>\n   \u672c\u7cfb\u5217\u8bfe\u7a0b\u76f8\u5173\u6e90\u7801\uff0c\u8bf7\u5355\u51fb\u8fd9\u4e2a\u94fe\u63a5\u83b7\u53d6\uff0c<br \/>\n   <a href=\"https:\/\/github.com\/luoweifu\/PyDesignPattern\"><br \/>\n    https:\/\/github.com\/luoweifu\/PyDesignPattern<br \/>\n   <\/a><br \/>\n   \u3002\n  <\/p>\n<h5>\n   <strong><br \/>\n    \u4f5c\u8005\u4ecb\u7ecd<br \/>\n   <\/strong><br \/>\n  <\/h5>\n<p>\n   \u7f57\u4f1f\u5bcc\uff08Spencer.Luo\uff09\uff0cCSDN \u535a\u5ba2\u4e13\u5bb6\uff0c\u67d0\u77e5\u540d\u5728\u7ebf\u6559\u80b2\u516c\u53f8\u6280\u672f\u4e13\u5bb6\u30023 \u5e74 SDK \u5f00\u53d1\uff0c2 \u5e74\u5ba2\u6237\u7aef\u5f00\u53d1\uff0c\u73b0\u4ece\u4e8b\u540e\u7aef\u57fa\u7840\u6280\u672f\u7814\u7a76\uff0c\u4ece\u5e95\u5c42\u5230\u5e94\u7528\u5c42\uff0c\u4ece\u524d\u7aef\u5230\u540e\u7aef\u79ef\u7d2f\u4e86\u4e30\u5bcc\u7684\u5f00\u53d1\u7ecf\u9a8c\uff0c\u719f\u6089 C++\u3001Java\u3001Python\u3001PHP \u7b49\u591a\u79cd\u4e0d\u540c\u5f00\u53d1\u8bed\u8a00\u3002\u70ed\u7231\u751f\u6d3b\u3001\u559c\u6b22\u6280\u672f\u3001\u5584\u4e8e\u7528\u751f\u6d3b\u7684\u573a\u666f\u89e3\u8bfb\u96be\u61c2\u7684\u6280\u672f\uff01\u5fae\u4fe1\u516c\u4f17\u53f7\uff1aSunLogging\uff0c\u4e2a\u4eba\u5fae\u4fe1\uff1aSmilingSunrise\u3002\n  <\/p>\n<h5>\n   <strong><br \/>\n    \u8bfe\u7a0b\u5185\u5bb9<br \/>\n   <\/strong><br \/>\n  <\/h5>\n<h6>\n   <strong><br \/>\n    \u5bfc\u8bfb\uff1a\u751f\u6d3b\u4e2d\u7684\u8bbe\u8ba1\u6a21\u5f0f\u2014\u2014\u542f\u7a0b\u4e4b\u524d\uff0c\u8bf7\u4e0d\u8981\u9519\u8fc7\u6211<br \/>\n   <\/strong><br \/>\n  <\/h6>\n<\/p>\n<div class=\"toc\">\n<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u4e3a\u4ec0\u4e48\u53eb\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u4ec0\u4e48\u662f\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u751f\u6d3b\u6709\u4ec0\u4e48\u8054\u7cfb<br \/>\n           <\/a>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u4e3a\u4ec0\u4e48\u8981\u5b66\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n         <\/a>\n        <\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u5982\u4f55\u8fdb\u884c\u5b66\u4e60<br \/>\n         <\/a>\n        <\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u4e3a\u4ec0\u4e48\u9009\u62e9 Python<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u5f25\u8865\u5e02\u573a\u7a7a\u7f3a<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u5927\u52bf\u6240\u8d8b\uff0cPython \u5df2\u7136\u6210\u98ce<br \/>\n           <\/a>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u7b80\u5355\u7684 Python \u57fa\u7840<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            Python \u7684\u7279\u70b9<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u57fa\u672c\u8bed\u6cd5<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u5e38\u7528\u5bb9\u5668<br \/>\n           <\/a><\/p>\n<ul>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              List\uff08\u5217\u8868\uff09<br \/>\n             <\/a>\n            <\/li>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              Tuple\uff08\u5143\u7ec4\uff09<br \/>\n             <\/a>\n            <\/li>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              Dictionary\uff08\u5b57\u5178\uff09<br \/>\n             <\/a>\n            <\/li>\n<\/ul>\n<\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u7c7b\u7684\u5b9a\u4e49<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            Demo \u8ba9\u4f60\u987f\u609f<br \/>\n           <\/a>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u91cd\u8981\u8bf4\u660e<br \/>\n         <\/a>\n        <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul><\/div>\n<p>\n   \u4e24\u5e74\u524d CSDN \u51fa\u4e86\u4e00\u4e2a\u4ea7\u54c1\u53eb ink\uff0c\u65e8\u5728\u63d0\u4f9b\u4e00\u4e2a\u9ad8\u8d28\u91cf\u7684\u5199\u4f5c\u73af\u5883\uff0c\u90a3\u65f6\u5c31\u6709\u5199\u8bbe\u8ba1\u6a21\u5f0f\u8fd9\u4e00\u7cfb\u5217\u7684\u60f3\u6cd5\u4e86\uff0c\u800c\u4e14\u4e5f\u786e\u5b9e\u5199\u4e86\uff0c\u5728 ink \u91cc\u5199\u4e86\u4e09\u7bc7\u6587\u7ae0\uff0c\u540e\u6765\u4e0d\u77e5\u9053\u4ec0\u4e48\u539f\u56e0\u8fd9\u4e2a\u4ea7\u54c1\u4e0b\u67b6\u4e86\uff0c\u5199\u7684\u4e09\u7bc7\u6587\u7ae0\u4e5f\u6ca1\u4e86\uff0c\u8fd9\u4e8b\u4e5f\u5c31\u4e00\u76f4\u88ab\u6401\u7f6e\u4e86\uff1b\u76f4\u5230\u4eca\u5929\uff0c\u6211\u60f3\u91cd\u65b0\u5f00\u59cb\uff0c\u4ee5\u5168\u65b0\u7684\u65b9\u5f0f\u548c\u601d\u8def\u91cd\u65b0\u5199\u8fd9\u4e00\u7cfb\u5217\u5185\u5bb9\uff01\n  <\/p>\n<ul>\n<li>\n    <strong><br \/>\n     \u6587\u7ae0\u7684\u7279\u70b9\uff1a<br \/>\n    <\/strong><br \/>\n    \u4ece\u751f\u6d3b\u7684\u5c0f\u6545\u4e8b\u5f00\u59cb\uff0c\u7531\u6d45\u5165\u6df1\uff0c\u9010\u6b65\u9610\u8ff0\u8bbe\u8ba1\u6a21\u5f0f\u7684\u601d\u60f3\uff0c\u5e76\u62bd\u8c61\u51fa\u4ee3\u7801\u6a21\u578b\uff08\u9aa8\u67b6\uff09\u3002\n   <\/li>\n<li>\n    <strong><br \/>\n     \u8ffd\u6c42\u7684\u5883\u754c\uff1a<br \/>\n    <\/strong><br \/>\n    \u7528\u6700\u901a\u4fd7\u7684\u8bed\u8a00\u9610\u8ff0\u6700\u96be\u61c2\u7684\u6982\u5ff5\uff1b\u7528\u6700\u7b80\u5355\u7684\u8bed\u6cd5\u5b9e\u73b0\u6700\u590d\u6742\u7684\u903b\u8f91\uff1b\u7528\u6700\u77ed\u5c0f\u7684\u4ee3\u7801\u5199\u51fa\u6700\u5f3a\u608d\u7684\u7a0b\u5e8f\uff01\n   <\/li>\n<\/ul>\n<h4>\n   \u4e3a\u4ec0\u4e48\u53eb\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n  <\/h4>\n<h5>\n   \u4ec0\u4e48\u662f\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n  <\/h5>\n<p>\n   <strong><br \/>\n    \u8bbe\u8ba1\u6a21\u5f0f<br \/>\n   <\/strong><br \/>\n   \u6700\u521d\u662f\u88ab GoF \u4e8e 1995 \u5e74\u63d0\u51fa\u7684\uff0cGoF\uff08Gang of Four\uff0c\u56db\u4eba\u5e2e\uff09\u5373 Erich Gamma\u3001Richard Helm\u3001Ralph Johnson\u548cJohn Vlissides\u3002\u4ed6\u4eec\u56db\u4eba\u4e8e 1995 \u5e74\u51fa\u7248\u4e86\u4e00\u672c\u4e66\u300aDesign Patterns\uff1aElements of Reusable Object-Oriented Software\u300b\uff08\u7ffb\u8bd1\u6210\u4e2d\u6587\u662f\u300a\u8bbe\u8ba1\u6a21\u5f0f \u53ef\u590d\u7528\u9762\u5411\u5bf9\u8c61\u8f6f\u4ef6\u7684\u57fa\u7840\u300b\uff09\uff0c\u7b2c\u4e00\u6b21\u5c06\u8bbe\u8ba1\u6a21\u5f0f\u63d0\u5347\u5230\u7406\u8bba\u9ad8\u5ea6\uff0c\u5e76\u5c06\u4e4b\u89c4\u8303\u5316\uff0c\u8be5\u4e66\u63d0\u51fa\u4e86 23 \u79cd\u7ecf\u5178\u7684\u8bbe\u8ba1\u6a21\u5f0f\u3002\n  <\/p>\n<p>\n   \u8bbe\u8ba1\u6a21\u5f0f\uff08Design Pattern\uff09\u662f\u4e00\u5957\u88ab\u53cd\u590d\u4f7f\u7528\u3001\u591a\u6570\u4eba\u77e5\u6653\u7684\u3001\u65e0\u6570\u5de5\u7a0b\u5e08\u5b9e\u8df5\u7684\u4ee3\u7801\u8bbe\u8ba1\u7ecf\u9a8c\u7684\u603b\u7ed3\uff0c\u5b83\u662f\u9762\u5411\u5bf9\u8c61\u601d\u60f3\u7684\u9ad8\u5ea6\u63d0\u70bc\u548c\u6a21\u677f\u5316\uff0c\u4f7f\u7528\u8bbe\u8ba1\u6a21\u5f0f\u662f\u4e3a\u4e86\u8ba9\u4ee3\u7801\u5177\u6709\u66f4\u9ad8\u7684\u53ef\u91cd\u7528\u6027\uff0c\u66f4\u597d\u7684\u7075\u6d3b\u6027\u548c\u53ef\u62d3\u5c55\u6027\uff0c\u66f4\u6613\u88ab\u4eba\u9605\u8bfb\u548c\u7406\u89e3\u3002GoF \u63d0\u5230\u7684\u6a21\u5f0f\u6709\u56db\u4e2a\u57fa\u672c\u8981\u7d20\uff1a\n  <\/p>\n<ul>\n<li>\n    \u6a21\u5f0f\u540d\u79f0\uff1a\u52a9\u8bb0\u540d\uff0c\u65b9\u4fbf\u8ba8\u8bba\u3001\u4ea4\u6d41\u3001\u4f20\u64ad\uff1b\n   <\/li>\n<li>\n    \u95ee\u9898\uff1a\u8be5\u6a21\u5f0f\u662f\u7528\u6765\u89e3\u51b3\u54ea\u7c7b\u5b9e\u9645\u95ee\u9898\uff0c\u5373\u5b83\u7684\u5e94\u7528\u573a\u666f\uff1b\n   <\/li>\n<li>\n    \u89e3\u51b3\u65b9\u6848\uff1a\u8bbe\u8ba1\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u5b83\u4eec\u4e4b\u95f4\u7684\u76f8\u4e92\u5173\u7cfb\u53ca\u5404\u81ea\u7684\u804c\u8d23\u548c\u534f\u4f5c\u65b9\u5f0f\uff1b\n   <\/li>\n<li>\n    \u6548\u679c\uff1a\u4f7f\u7528\u6a21\u5f0f\u80fd\u8fbe\u5230\u7684\u6548\u679c\uff0c\u5373\u5bf9\u4f7f\u7528\u6761\u4ef6\u7684\u6743\u8861\u53d6\u820d\u3002\n   <\/li>\n<\/ul>\n<h5>\n   \u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u751f\u6d3b\u6709\u4ec0\u4e48\u8054\u7cfb<br \/>\n  <\/h5>\n<p>\n   \u6211\u4e00\u76f4\u575a\u4fe1\uff1a\u7a0b\u5e8f\u6e90\u4e8e\u751f\u6d3b\uff0c\u53c8\u9ad8\u4e8e\u751f\u6d3b\uff01\u7a0b\u5e8f\u7684\u7075\u9b42\u5728\u4e8e\u601d\u7ef4\u7684\u65b9\u5f0f\uff0c\u800c\u601d\u7ef4\u7684\u7075\u611f\u6765\u6e90\u4e8e\u751f\u6d3b\u7684\u7cbe\u5f69\u3002\u4e92\u8054\u7f51\u662f\u4e00\u4e2a\u865a\u62df\u7684\u4e16\u754c\uff0c\u800c\u7a0b\u5e8f\u672c\u8eab\u5c31\u662f\u5bf9\u751f\u6d3b\u573a\u666f\u7684\u865a\u62df\u548c\u62bd\u8c61\uff0c\u6bcf\u4e00\u4e2a\u6a21\u5f0f\u6211\u90fd\u80fd\u5728\u751f\u6d3b\u4e2d\u627e\u5230\u4ed6\u7684\u5f71\u5b50\u3002\u6bd4\u5982\uff0c\u8bf4\u5230\u72b6\u6001\u6a21\u5f0f\u6211\u80fd\u60f3\u5230\u6c34\u6709\u51b0\u3001\u6c34\u3001\u6c14\u4e09\u79cd\u72b6\u6001\uff0c\u800c\u4eba\u4e5f\u6709\u5c11\u3001\u58ee\u3001\u8001\u4e09\u4e2a\u4e0d\u540c\u7684\u9636\u6bb5\uff1b\u63d0\u8d77\u4e2d\u4ecb\u6a21\u5f0f\u6211\u80fd\u7acb\u9a6c\u60f3\u5230\u623f\u4ea7\u4e2d\u4ecb\uff1b\u770b\u5230\u5355\u4f8b\u6a21\u5f0f\uff0c\u8111\u6d77\u4e2d\u4f1a\u5373\u523b\u6d6e\u73b0\u5fc3\u76ee\u4e2d\u7684\u90a3\u4e2a\u5979\u2026\u2026\n  <\/p>\n<p>\n   \u8bbe\u8ba1\u6a21\u5f0f\u662f\u9762\u5411\u5bf9\u8c61\u7684\u9ad8\u5ea6\u62bd\u8c61\u548c\u603b\u7ed3\uff0c\u800c\u8d8a\u62bd\u8c61\u7684\u4e1c\u897f\u8d8a\u96be\u4ee5\u7406\u89e3\u3002\u672c\u7cfb\u5217\u6587\u7ae0\u7684\u76ee\u5730\u5c31\u662f\u4e3a\u4e86\u964d\u4f4e\u8bbe\u8ba1\u6a21\u5f0f\u7684\u9605\u8bfb\u95e8\u69db\uff0c\u4ee5\u751f\u6d3b\u4e2d\u7684\u5c0f\u6545\u4e8b\u5f00\u59cb\uff0c\u7528\u98ce\u8da3\u7684\u65b9\u5f0f\uff0c\u7531\u6d45\u5165\u6df1\u5730\u8bb2\u8ff0\u6bcf\u4e00\u4e2a\u6a21\u5f0f\u3002\u8ba9\u4f60\u518d\u6b21\u770b\u5230\u8bbe\u8ba1\u6a21\u5f0f\u65f6\u4e0d\u53ea\u662f\u4e00\u4e2a\u6a21\u5f0f\uff0c\u8fd8\u662f\u751f\u6d3b\u4e2d\u7684\u4e00\u4e2a\u4e2a\u5c0f\u786e\u5e78\uff01\u7a0b\u5e8f\u4e0d\u662f\u51b7\u51b0\u51b0\u7684\u4ee3\u7801\uff0c\u5b83\u8fd8\u6709\u751f\u6d3b\u7684\u4e50\u8da3\u548c\u7279\u6b8a\u610f\u4e49\u3002\n  <\/p>\n<h4>\n   \u4e3a\u4ec0\u4e48\u8981\u5b66\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n  <\/h4>\n<p>\n   \u8bbe\u8ba1\u6a21\u5f0f\u662f\u8f6f\u4ef6\u5f00\u53d1\u4eba\u5458\u5728\u8f6f\u4ef6\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9762\u4e34\u7684\u4e00\u822c\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u8fd9\u4e9b\u89e3\u51b3\u65b9\u6848\u662f\u4f17\u591a\u8f6f\u4ef6\u5f00\u53d1\u4eba\u5458\u7ecf\u8fc7\u76f8\u5f53\u957f\u7684\u4e00\u6bb5\u65f6\u95f4\u7684\u8bd5\u9a8c\u548c\u9519\u8bef\u603b\u7ed3\u51fa\u6765\u7684\u3002\u6240\u4ee5\u4e0d\u7ba1\u4f60\u662f\u65b0\u624b\u8fd8\u662f\u8001\u624b\uff0c\u5b66\u4e60\u8bbe\u8ba1\u6a21\u5f0f\u5c06\u5bf9\u4f60\u90fd\u6709\u83ab\u5927\u7684\u5e2e\u52a9\u3002\n  <\/p>\n<p>\n   \u5b66\u4e60\u8bbe\u8ba1\u6a21\u5f0f\u7684\u7406\u7531\u6709\u5f88\u591a\uff0c\u8fd9\u91cc\u53ea\u5217\u51fa\u51e0\u4e2a\u6700\u5b9e\u73b0\u7684\uff1a\n  <\/p>\n<ul>\n<li>\n    \u6446\u8131\u9762\u8bd5\u7684\u7a98\u5883\uff0c\u4e0d\u7ba1\u662f\u524d\u7aef\u5de5\u7a0b\u5e08\u8fd8\u662f\u540e\u7aef\u5de5\u7a0b\u5e08\uff0c\u4ea6\u6216\u662f\u5168\u7aef\u5de5\u7a0b\u5e08\uff0c\u8bbe\u8ba1\u6a21\u5f0f\u662f\u9762\u8bd5\u65f6\u5fc5\u95ee\u7684\u4e00\u9053\u9898\u3002\n   <\/li>\n<li>\n    \u8ba9\u7a0b\u5e8f\u8bbe\u8ba1\u80fd\u529b\u6709\u4e00\u4e2a\u8d28\u7684\u63d0\u5347\uff0c\u4e0d\u518d\u662f\u5199\u4e00\u5806\u7ed3\u6784\u590d\u6742\u3001\u96be\u4ee5\u7ef4\u62a4\u7684\u70c2\u4ee3\u7801\u3002\n   <\/li>\n<li>\n    \u5bf9\u9762\u5411\u5bf9\u8c61\u7684\u601d\u60f3\u6709\u4e00\u4e2a\u66f4\u9ad8\u5c42\u6b21\u7684\u7406\u89e3\u3002\n   <\/li>\n<\/ul>\n<h4>\n   \u5982\u4f55\u8fdb\u884c\u5b66\u4e60<br \/>\n  <\/h4>\n<p>\n   <strong><br \/>\n    \u719f\u6089\u4e00\u95e8\u9762\u5411\u5bf9\u8c61\u8bed\u8a00<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   \u9996\u5148\uff0c\u81f3\u5c11\u8981\u719f\u6089\u4e00\u95e8\u9762\u5411\u5bf9\u8c61\u7684\u8ba1\u7b97\u673a\u8bed\u8a00\u3002\u5982\u679c\u6ca1\u6709\uff0c\u8bf7\u6839\u636e\u81ea\u5df1\u7684\u5b66\u4e60\u7231\u597d\uff0c\u6216\u5e0c\u671b\u4ece\u4e8b\u7684\u5de5\u4f5c\uff0c\u5148\u9009\u62e9\u4e00\u95e8\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\uff08C++\u3001Java\u3001Python\u3001Go \u7b49\u90fd\u53ef\u4ee5\uff09\u8fdb\u884c\u5b66\u4e60\u548c\u5b9e\u6218\uff0c\u5bf9\u62bd\u8c61\u3001\u7ee7\u627f\u3001\u591a\u6001\u3001\u5c01\u88c5\u6709\u4e00\u5b9a\u7684\u57fa\u7840\u4e4b\u540e\uff0c\u518d\u6765\u770b\u672c\u7cfb\u5217\u7684\u6587\u7ae0\u5185\u5bb9\u3002\n  <\/p>\n<p>\n   <strong><br \/>\n    \u4e86\u89e3 Python \u7684\u57fa\u672c\u8bed\u6cd5<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   \u5bf9 Python \u7684\u57fa\u672c\u8bed\u6cd5\u6709\u4e00\u4e2a\u7b80\u5355\u4e86\u89e3\u3002Python \u8bed\u6cd5\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u8981\u6709\u4e00\u5b9a\u7684\u7f16\u7a0b\u8bed\u8a00\u57fa\u7840\uff0c\u901a\u8fc7\u4e0b\u6587\u7684\u4ecb\u7ecd\u5f88\u5feb\u5c31\u80fd\u7406\u89e3\u7684\u3002\n  <\/p>\n<p>\n   <strong><br \/>\n    \u5b66\u4f1a\u9605\u8bfb UML \u56fe<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   UML\uff08Unified Modeling Language\uff09\u79f0\u4e3a\u7edf\u4e00\u5efa\u6a21\u8bed\u8a00\u6216\u6807\u51c6\u5efa\u6a21\u8bed\u8a00\uff0c\u662f\u9762\u5411\u5bf9\u8c61\u8f6f\u4ef6\u7684\u6807\u51c6\u5316\u5efa\u6a21\u8bed\u8a00\u3002UML \u89c4\u8303\u7528\u6765\u63cf\u8ff0\u5efa\u6a21\u7684\u6982\u5ff5\u6709\uff1a\u7c7b\uff08\u5bf9\u8c61\u7684\uff09\u3001\u5bf9\u8c61\u3001\u5173\u8054\u3001\u804c\u8d23\u3001\u884c\u4e3a\u3001\u63a5\u53e3\u3001\u7528\u4f8b\u3001\u5305\u3001\u987a\u5e8f\u3001\u534f\u4f5c\u4ee5\u53ca\u72b6\u6001\u3002\n  <\/p>\n<p>\n   UML \u7c7b\u56fe\u8868\u793a\u4e0d\u540c\u7684\u5b9e\u4f53\uff08\u4eba\u3001\u4e8b\u7269\u548c\u6570\u636e\uff09\u5982\u4f55\u5f7c\u6b64\u76f8\u5173\uff1b\u6362\u53e5\u8bdd\u8bf4\uff0c\u5b83\u663e\u793a\u4e86\u7cfb\u7edf\u7684\u9759\u6001\u7ed3\u6784\u3002\u60f3\u8fdb\u4e00\u6b65\u4e86\u89e3\u7c7b\u56fe\u4e2d\u7684\u5404\u79cd\u5173\u7cfb\uff0c\u53ef\u53c2\u8003\u4ee5\u4e0b\u6587\u7ae0\uff1a\n  <\/p>\n<ul>\n<li>\n    <a href=\"http:\/\/www.tk4479.net\/luoweifu\/article\/details\/25817471\" rel=\"nofollow\"><br \/>\n     UML \u7c7b\u56fe\u5173\u7cfb\u5927\u5168<br \/>\n    <\/a>\n   <\/li>\n<li>\n    <a href=\"http:\/\/www.cnblogs.com\/olvo\/archive\/2012\/05\/03\/2481014.html\" rel=\"nofollow\"><br \/>\n     UML \u7c7b\u56fe\u5173\u7cfb\uff08\u6cdb\u5316 \u3001\u7ee7\u627f\u3001\u5b9e\u73b0\u3001\u4f9d\u8d56\u3001\u5173\u8054\u3001\u805a\u5408\u3001\u7ec4\u5408\uff09<br \/>\n    <\/a>\n   <\/li>\n<\/ul>\n<p>\n   <strong><br \/>\n    \u9605\u8bfb\u672c\u7cfb\u5217\u6587\u7ae0<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   \u901a\u8fc7\u9605\u8bfb\u672c\u7cfb\u5217\u6587\u7ae0\uff0c\u4ee5\u8f7b\u677e\u6109\u5feb\u7684\u65b9\u5f0f\u5b66\u4e60\u8bbe\u8ba1\u6a21\u5f0f\u548c\u7f16\u7a0b\u601d\u60f3\u3002\u672c\u7cfb\u5217\u6587\u7ae0\u6ca1\u6709\u9605\u8bfb\u7684\u5148\u540e\u987a\u5e8f\uff0c\u6bcf\u4e00\u7ae0\u90fd\u662f\u5355\u72ec\u6210\u6587\uff0c\u53ef\u4ece\u4efb\u610f\u4e00\u7bc7\u6587\u7ae0\u5f00\u59cb\u3002\n  <\/p>\n<h4>\n   \u4e3a\u4ec0\u4e48\u9009\u62e9 Python<br \/>\n  <\/h4>\n<p>\n   \u867d\u7136\u8bf4\u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u7f16\u7a0b\u8bed\u8a00\u6ca1\u6709\u5173\u7cfb\uff0c\u5b83\u662f\u5bf9\u9762\u5411\u5bf9\u8c61\u601d\u60f3\u7684\u7075\u6d3b\u5e94\u7528\u548c\u9ad8\u5ea6\u6982\u62ec\uff0c\u53ef\u4ee5\u7528\u4efb\u4f55\u4e00\u79cd\u8bed\u8a00\u6765\u5b9e\u73b0\u5b83\uff0c\u4f46\u603b\u5f52\u662f\u9700\u8981\u7528\u4e00\u79cd\u8bed\u8a00\u8fdb\u884c\u4e3e\u4f8b\u7684\u3002\u672c\u7cfb\u5217\u6587\u7ae0\u7684\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u5747\u4f7f\u7528 Python \u8bed\u8a00\u7f16\u5199\uff0c\u4e3a\u4ec0\u4e48\u9009\u62e9 Python\uff0c\u4e3b\u8981\u662f\u57fa\u4e8e\u4ee5\u4e0b\u4e24\u4e2a\u539f\u56e0\u3002\n  <\/p>\n<h5>\n   \u5f25\u8865\u5e02\u573a\u7a7a\u7f3a<br \/>\n  <\/h5>\n<p>\n   \u8bbe\u8ba1\u6a21\u5f0f\u4e8e 1995 \u88ab GoF \u63d0\u51fa\uff0c\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u70ed\u95e8\u7684\u9762\u5bf9\u8c61\u8bed\u8a00\u3002\u76ee\u524d\u7528 Java\u3001C++ \u63cf\u8ff0\u7684\u8bbe\u8ba1\u6a21\u5f0f\u7684\u4e66\u7c4d\u548c\u8d44\u6599\u5df2\u7ecf\u975e\u5e38\u591a\u4e86\uff0c\u4f46\u7528 Python \u6765\u63cf\u8ff0\u7684\u771f\u662f\u592a\u5c11\u4e86\uff1b\u6211\u5728\u5f53\u5f53\u4e0a\u641c\u7d22\u4e86\u4e00\u4e0b\u201cPython \u8bbe\u8ba1\u6a21\u5f0f\u201d\u5173\u952e\u5b57\uff0c\u53d1\u73b0\u53ea\u6709\u90a3\u96f6\u661f\u7684\u51e0\u672c\u4e66\u3002\u800c\u4f5c\u4e3a\u5df2\u7ecf\u6324\u8fdb Top4 \u7684 Python \u8bed\u8a00\uff0c\u8fd9\u660e\u793a\u662f\u4e0d\u591f\u7684\u3002Python \u5df2\u7ecf\u8d8a\u6765\u8d8a\u6210\u719f\uff0c\u4e5f\u8d8a\u6765\u8d8a\u591a\u5730\u88ab\u4f7f\u7528\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u6709\u6280\u672f\u8ffd\u6c42\u7684 IT \u513f\u6709\u5fc5\u8981\u4e86\u89e3\u4e00\u4e0b\u57fa\u4e8e Python \u4ee3\u7801\u8bbe\u8ba1\u3002\n  <\/p>\n<h5>\n   \u5927\u52bf\u6240\u8d8b\uff0cPython \u5df2\u7136\u6210\u98ce<br \/>\n  <\/h5>\n<ul>\n<li>\n    C \u8bed\u8a00\u8bde\u751f\u4e8e 1972 \u5e74\uff0c\u786e\u968f\u7740 Unix \u7684\u8bde\u751f\u624d\u6df1\u6df1\u690d\u6839\u4e8e\u5404\u5927\u64cd\u4f5c\u7cfb\u7edf\uff1b\n   <\/li>\n<li>\n    C++ \u8bed\u8a00\u8bde\u751f\u4e8e 1983 \u5e74\uff0c\u786e\u56e0\u5fae\u8f6f\u7684\u53ef\u89c6\u5316\u684c\u9762\u64cd\u4f5c\u7cfb\u7edf\u624d\u5f97\u4ee5\u5e7f\u6cdb\u4f20\u64ad\uff1b\n   <\/li>\n<li>\n    Java \u8bed\u8a00\u8bde\u751f\u4e8e 1995 \u5e74\uff0c\u786e\u56e0\u4e92\u8054\u7f51\u7684\u8fc5\u901f\u5d1b\u8d77\u624d\u53d8\u5f97\u5bb6\u55bb\u6237\u6653\uff1b\n   <\/li>\n<li>\n    Python \u8bed\u8a00\u8bde\u751f\u4e8e 1991 \u5e74\uff0c\u800c\u4e0b\u4e00\u573a\u6280\u672f\u9769\u547d\u5df2\u7136\u5f00\u59cb\uff0cAI \u65f6\u4ee3\u5df2\u7136\u6210\u98ce\u3002\u5728 AI \u9886\u57df\u4e2d\u5df2\u7ecf\u88ab\u5e7f\u6cdb\u4f7f\u7528\u7684 Python \u8bed\u8a00\u5fc5\u5c06\u6210\u4e3a\u4e0b\u4e00\u4e2a\u65f6\u4ee3\u7684\u7b2c\u4e00\u5f00\u53d1\u8bed\u8a00\uff01\n   <\/li>\n<\/ul>\n<p>\n   \u6700\u70ed\u95e8\u7684 AI \u5f00\u6e90\u6846\u67b6 PyTorch \u548c TensorFlow \u90fd\u5df2\u7ecf\u91c7\u7528\u4e86 Python \u4f5c\u4e3a\u63a5\u53e3\u548c\u5f00\u53d1\u8bed\u8a00\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u6709\u4e00\u5806\u7684 AI \u76f8\u5173\u7684\u6846\u67b6\u5e93\uff0c\u4e5f\u90fd\u7eb7\u7eb7\u91c7\u7528\uff0c\u5982 AIMA\u3001pyDatalog\u3001SimpleAI\u3001PyBrain\u3001PyML \u7b49\u3002\n  <\/p>\n<p>\n   \u4f5c\u4e3a\u8fd9\u4e48\u4e00\u95e8\u6709\u524d\u9014\u7684\u8bed\u8a00\uff0c\u5fc5\u7136\u662f\u8981\u53bb\u5b66\u4e60\u548c\u4f7f\u7528\u7684\u3002\n  <\/p>\n<h4>\n   \u7b80\u5355\u7684 Python \u57fa\u7840<br \/>\n  <\/h4>\n<p>\n   \u5982\u679c\u5df2\u7ecf\u719f\u6089 Python \u8bed\u8a00\uff0c\u8fd9\u4e00\u90e8\u5206\u7684\u5185\u5bb9\u53ef\u76f4\u63a5\u8df3\u8fc7\uff01\n  <\/p>\n<h5>\n   Python \u7684\u7279\u70b9<br \/>\n  <\/h5>\n<p>\n   Python \u5d07\u5c1a\u4f18\u7f8e\u3001\u6e05\u6670\u3001\u7b80\u5355\uff0c\u662f\u4e00\u4e2a\u4f18\u79c0\u5e76\u5e7f\u6cdb\u4f7f\u7528\u7684\u8bed\u8a00\u3002\n  <\/p>\n<p>\n   \u4e0e Java \u548c C++ \u8fd9\u4e9b\u8bed\u8a00\u76f8\u6bd4\uff0cPython \u6700\u5927\u7684\u4e24\u4e2a\u7279\u70b9\u662f\uff1a\n  <\/p>\n<ul>\n<li>\n    \u8bed\u53e5\u7ed3\u675f\u4e0d\u7528\u5206\u53f7\u201c;\u201d\u3002\n   <\/li>\n<li>\n    \u4ee3\u7801\u5757\u7528\u7f29\u8fdb\u6765\u63a7\u5236\uff0c\u800c\u4e0d\u7528\u5927\u62ec\u53f7\u201c{}\u201d\u3002\n   <\/li>\n<\/ul>\n<p>\n   \u521a\u8f6c\u8fc7\u6765\u7684\u65f6\u5019\u53ef\u80fd\u4f1a\u6709\u70b9\u4e0d\u9002\uff0c\u7528\u4e00\u6bb5\u65f6\u95f4\u5c31\u597d\u4e86\uff01\n  <\/p>\n<p>\n   \u4e2a\u4eba\u89c9\u5f97\uff0c\u5728\u6240\u6709\u7684\u9ad8\u7ea7\u8ba1\u7b97\u673a\u8bed\u8a00\u4e2d\uff0cPython \u662f\u6700\u63a5\u8fd1\u4eba\u7c7b\u81ea\u7136\u8bed\u8a00\u7684\u3002Python \u7684\u8bed\u6cd5\u3001\u98ce\u683c\u90fd\u4e0e\u82f1\u6587\u7684\u4e66\u5199\u4e60\u60ef\u975e\u5e38\u63a5\u8fd1\uff0cPython \u7684\u8fd9\u79cd\u98ce\u683c\u88ab\u79f0\u4e3a Pythonic\uff0c\u5982\u6761\u4ef6\u8868\u8fbe\u5f0f\uff0c\u5728 Java \u548c C++ \u4e2d\u662f\u8fd9\u6837\u7684\uff1a\n  <\/p>\n<pre><code>int min = x &lt; y ? x : y<\/code><\/pre>\n<p>\n   \u800c Python \u662f\u8fd9\u6837\u7684\uff1a\n  <\/p>\n<pre><code>min = x if x &lt; y else y<\/code><\/pre>\n<p>\n   \u6709\u6ca1\u6709\u89c9\u5f97\u7b2c\u4e8c\u79cd\u65b9\u5f0f\u66f4\u63a5\u8fd1\u4eba\u7c7b\u7684\u81ea\u7136\u601d\u7ef4\uff1f\n  <\/p>\n<h5>\n   \u57fa\u672c\u8bed\u6cd5<br \/>\n  <\/h5>\n<p>\n   <strong><br \/>\n    \u6570\u636e\u7c7b\u578b<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   Python \u662f\u4e00\u79cd\u5f31\u7c7b\u578b\u7684\u8bed\u8a00\uff0c\u53d8\u91cf\u7684\u5b9a\u4e49\u4e0d\u9700\u8981\u5728\u524d\u9762\u52a0\u7c7b\u578b\u8bf4\u660e\uff0c\u800c\u4e14\u4e0d\u540c\u7c7b\u578b\u4e4b\u95f4\u53ef\u4ee5\u65b9\u4fbf\u5730\u76f8\u4e92\u8f6c\u6362\u3002Python \u6709\u4e94\u4e2a\u6807\u51c6\u7684\u6570\u636e\u7c7b\u578b\uff1a\n  <\/p>\n<ul>\n<li>\n    Numbers\uff08\u6570\u5b57\uff09\n   <\/li>\n<li>\n    String\uff08\u5b57\u7b26\u4e32\uff09\n   <\/li>\n<li>\n    List\uff08\u5217\u8868\uff09\n   <\/li>\n<li>\n    Tuple\uff08\u5143\u7ec4\uff09\n   <\/li>\n<li>\n    Dictionary\uff08\u5b57\u5178\uff09\n   <\/li>\n<\/ul>\n<p>\n   \u5176\u4e2d List\u3001Tuple\u3001Dictionary \u4e3a\u5bb9\u5668\uff0c\u5c06\u5728\u4e0b\u4e00\u90e8\u5206\u4ecb\u7ecd\u3002Python \u652f\u6301\u56db\u79cd\u4e0d\u540c\u7684\u6570\u5b57\u7c7b\u578b\uff1aint\uff08\u6709\u7b26\u53f7\u6574\u578b\uff09\u3001long\uff08\u957f\u6574\u578b\uff09\u3001float\uff08\u6d6e\u70b9\u578b\uff09\u3001complex\uff08\u590d\u6570\uff09\u3002\n  <\/p>\n<p>\n   \u6bcf\u4e2a\u53d8\u91cf\u5728\u4f7f\u7528\u524d\u90fd\u5fc5\u987b\u8d4b\u503c\uff0c\u53d8\u91cf\u8d4b\u503c\u4ee5\u540e\u8be5\u53d8\u91cf\u624d\u4f1a\u88ab\u521b\u5efa\u3002\n  <\/p>\n<p>\n   Demo\uff1a\n  <\/p>\n<pre><code>age = 18        # intweight = 62.51  # floatname = \"Tony\"    # stringprint(\"age:\", age)print(\"weight:\", weight)print(\"name:\", name)# \u53d8\u91cf\u7684\u7c7b\u578b\u53ef\u4ee5\u76f4\u63a5\u6539\u53d8age = nameprint(\"age:\", age)a = b = c = 5# a,b,c\u4e09\u4e2a\u53d8\u91cf\u6307\u5411\u76f8\u540c\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u5177\u6709\u76f8\u540c\u7684\u503cprint(\"a:\", a, \"b:\", b, \"c:\", c)print(\"id(a):\", id(a), \"id(b):\", id(b), \"id(c):\", id(c))<\/code><\/pre>\n<p>\n   \u7ed3\u679c\uff1a\n  <\/p>\n<pre><code>age: 18weight: 62.51name: Tonyage: Tonya: 5 b: 5 c: 5id(a): 1457772400 id(b): 1457772400 id(c): 1457772400<\/code><\/pre>\n<h5>\n   \u5e38\u7528\u5bb9\u5668<br \/>\n  <\/h5>\n<h6>\n   <strong><br \/>\n    List\uff08\u5217\u8868\uff09<br \/>\n   <\/strong><br \/>\n  <\/h6>\n<p>\n   List\uff08\u5217\u8868\uff09\u662f Python \u4e2d\u4f7f\u7528\u6700\u9891\u7e41\u7684\u6570\u636e\u7c7b\u578b\uff0c\u7528 [ ] \u6807\u8bc6\u3002\n  <\/p>\n<p>\n   \u5217\u8868\u53ef\u4ee5\u5b8c\u6210\u5927\u591a\u6570\u96c6\u5408\u7c7b\u7684\u6570\u636e\u7ed3\u6784\u5b9e\u73b0\u3002\u7c7b\u4f3c\u4e8e Java \u4e2d\u7684 ArrayList\uff0cC++ \u4e2d\u7684 Vector\u3002\u6b64\u5916\uff0c\u4e00\u4e2a List \u4e2d\u8fd8\u53ef\u4ee5\u540c\u65f6\u5305\u542b\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\uff0c\u652f\u6301\u5b57\u7b26\u3001\u6570\u5b57\u3001\u5b57\u7b26\u4e32\uff0c\u751a\u81f3\u53ef\u4ee5\u5305\u542b\u5217\u8868\uff08\u5373\u5d4c\u5957\uff09\u3002\n  <\/p>\n<ul>\n<li>\n    \u5217\u8868\u4e2d\u503c\u7684\u5207\u5272\u4e5f\u53ef\u4ee5\u7528\u5230\u53d8\u91cf [\u5934\u4e0b\u6807:\u5c3e\u4e0b\u6807] \uff0c\u5c31\u53ef\u4ee5\u622a\u53d6\u76f8\u5e94\u7684\u5217\u8868\uff0c\u4ece\u5de6\u5230\u53f3\u7d22\u5f15\u9ed8\u8ba4 0 \u5f00\u59cb\uff0c\u4ece\u53f3\u5230\u5de6\u7d22\u5f15\u9ed8\u8ba4 -1 \u5f00\u59cb\uff0c\u4e0b\u6807\u53ef\u4ee5\u4e3a\u7a7a\u8868\u793a\u53d6\u5230\u5934\u6216\u5c3e\u3002\n   <\/li>\n<li>\n    \u52a0\u53f7\uff08+\uff09\u662f\u5217\u8868\u8fde\u63a5\u8fd0\u7b97\u7b26\uff0c\u661f\u53f7\uff08*\uff09\u662f\u91cd\u590d\u64cd\u4f5c\u3002\n   <\/li>\n<\/ul>\n<p>\n   Demo\uff1a\n  <\/p>\n<pre><code>list = ['Thomson', 78, 12.58, 'Sunny', 180.2]tinylist = [123, 'Tony']print(list)             # \u8f93\u51fa\u5b8c\u6574\u5217\u8868print(list[0])          # \u8f93\u51fa\u5217\u8868\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20print(list[1:3])          # \u8f93\u51fa\u7b2c\u4e8c\u4e2a\u81f3\u7b2c\u4e09\u4e2a\u5143\u7d20print(list[2:])          # \u8f93\u51fa\u4ece\u7b2c\u4e09\u4e2a\u5f00\u59cb\u81f3\u5217\u8868\u672b\u5c3e\u7684\u6240\u6709\u5143\u7d20print(tinylist * 2)      # \u8f93\u51fa\u5217\u8868\u4e24\u6b21print(list + tinylist)  # \u6253\u5370\u7ec4\u5408\u7684\u5217\u8868list[1] = 100            # \u4fee\u6539\u7b2c\u4e8c\u4e2a\u5143\u7d20\u7684\u503cprint(list)              # \u8f93\u51fa\u5b8c\u6574\u5217\u8868list.append(\"added data\")print(list)              # \u8f93\u51fa\u589e\u52a0\u540e\u7684\u5217\u8868<\/code><\/pre>\n<p>\n   \u7ed3\u679c\uff1a\n  <\/p>\n<pre><code>['Thomson', 78, 12.58, 'Sunny', 180.2]Thomson[78, 12.58][12.58, 'Sunny', 180.2][123, 'Tony', 123, 'Tony']['Thomson', 78, 12.58, 'Sunny', 180.2, 123, 'Tony']['Thomson', 100, 12.58, 'Sunny', 180.2]['Thomson', 100, 12.58, 'Sunny', 180.2, 'added data']<\/code><\/pre>\n<h6>\n   Tuple\uff08\u5143\u7ec4\uff09<br \/>\n  <\/h6>\n<p>\n   Tuple\uff08\u5143\u7ec4\uff09\u662f\u53e6\u4e00\u4e2a\u6570\u636e\u7c7b\u578b\uff0c\u5143\u7ec4\u7528\u201c()\u201d\u6807\u8bc6\uff0c\u5185\u90e8\u5143\u7d20\u7528\u9017\u53f7\u9694\u5f00\u3002\u5143\u7ec4\u4e0d\u80fd\u4e8c\u6b21\u8d4b\u503c\uff0c\u76f8\u5f53\u4e8e\u53ea\u8bfb\u5217\u8868\uff0c\u7528\u6cd5\u4e0e List \u7c7b\u4f3c\u3002Tuple \u76f8\u5f53\u4e8e Java \u4e2d\u7684 final \u6570\u7ec4\uff0cC++ \u4e2d\u7684 const \u6570\u7ec4\u3002\n  <\/p>\n<p>\n   Demo\uff1a\n  <\/p>\n<pre><code>tuple = ('Thomson', 78, 12.58, 'Sunny', 180.2)tinytuple = (123, 'Tony')print(tuple)              # \u8f93\u51fa\u5b8c\u6574\u5143\u7ec4print(tuple[0])          # \u8f93\u51fa\u5143\u7ec4\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20print(tuple[1:3])          # \u8f93\u51fa\u7b2c\u4e8c\u4e2a\u81f3\u7b2c\u4e09\u4e2a\u7684\u5143\u7d20print(tuple[2:])          # \u8f93\u51fa\u4ece\u7b2c\u4e09\u4e2a\u5f00\u59cb\u81f3\u5217\u8868\u672b\u5c3e\u7684\u6240\u6709\u5143\u7d20print(tinytuple * 2)      # \u8f93\u51fa\u5143\u7ec4\u4e24\u6b21print(tuple + tinytuple)# \u6253\u5370\u7ec4\u5408\u7684\u5143\u7ec4# tuple[1] = 100         # \u4e0d\u80fd\u4fee\u6539\u5143\u7ec4\u5185\u7684\u5143\u7d20<\/code><\/pre>\n<p>\n   \u7ed3\u679c\uff1a\n  <\/p>\n<pre><code>('Thomson', 78, 12.58, 'Sunny', 180.2)Thomson(78, 12.58)(12.58, 'Sunny', 180.2)(123, 'Tony', 123, 'Tony')('Thomson', 78, 12.58, 'Sunny', 180.2, 123, 'Tony')<\/code><\/pre>\n<h6>\n   Dictionary\uff08\u5b57\u5178\uff09<br \/>\n  <\/h6>\n<p>\n   Dictionary\uff08\u5b57\u5178\uff09\u662f Python \u4e2d\u9664\u5217\u8868\u4ee5\u5916\u6700\u7075\u6d3b\u7684\u5185\u7f6e\u6570\u636e\u7ed3\u6784\u7c7b\u578b\u3002\u5b57\u5178\u7528\u201c{ }\u201d\u6807\u8bc6\uff0c\u5b57\u5178\u7531\u7d22\u5f15\uff08key\uff09\u548c\u5b83\u5bf9\u5e94\u7684\u503c value \u7ec4\u6210\uff0c\u76f8\u5f53\u4e8e Java \u548c C++ \u4e2d\u7684 Map\u3002\n  <\/p>\n<p>\n   \u5217\u8868\u662f\u6709\u5e8f\u7684\u5bf9\u8c61\u96c6\u5408\uff0c\u5b57\u5178\u662f\u65e0\u5e8f\u7684\u5bf9\u8c61\u96c6\u5408\u3002\u4e24\u8005\u4e4b\u95f4\u7684\u533a\u522b\u5728\u4e8e\uff1a\u5b57\u5178\u5f53\u4e2d\u7684\u5143\u7d20\u662f\u901a\u8fc7\u952e\u6765\u5b58\u53d6\u7684\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u504f\u79fb\u5b58\u53d6\u3002\n  <\/p>\n<p>\n   Demo\uff1a\n  <\/p>\n<pre><code>dict = {}dict['one'] = \"This is one\"dict[2] = \"This is two\"tinydict = {'name': 'Tony', 'age': 24, 'height': 177}print(dict['one'])      # \u8f93\u51fa\u952e\u4e3a'one' \u7684\u503cprint(dict[2])          # \u8f93\u51fa\u952e\u4e3a 2 \u7684\u503cprint(tinydict)         # \u8f93\u51fa\u5b8c\u6574\u7684\u5b57\u5178print(tinydict.keys())  # \u8f93\u51fa\u6240\u6709\u952eprint(tinydict.values())# \u8f93\u51fa\u6240\u6709\u503c<\/code><\/pre>\n<p>\n   \u7ed3\u679c\uff1a\n  <\/p>\n<pre><code>This is oneThis is two{'name': 'Tony', 'age': 24, 'height': 177}dict_keys(['name', 'age', 'height'])dict_values(['Tony', 24, 177])<\/code><\/pre>\n<h5>\n   \u7c7b\u7684\u5b9a\u4e49<br \/>\n  <\/h5>\n<p>\n   \u4f7f\u7528 class \u8bed\u53e5\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7c7b\uff0cclass \u4e4b\u540e\u4e3a\u7c7b\u7684\u540d\u79f0\u5e76\u4ee5\u5192\u53f7\u7ed3\u5c3e\uff0c\u5982\u4e0b\u5b9e\u4f8b\uff1a\n  <\/p>\n<pre><code>class ClassName:   '\u7c7b\u7684\u5e2e\u52a9\u4fe1\u606f'   #\u7c7b\u6587\u6863\u5b57\u7b26\u4e32   class_suite  #\u7c7b\u4f53<\/code><\/pre>\n<p>\n   \u7c7b\u7684\u5e2e\u52a9\u4fe1\u606f\u53ef\u4ee5\u901a\u8fc7 ClassName.<br \/>\n   <code><br \/>\n    __doc__<br \/>\n   <\/code><br \/>\n   \u67e5\u770b\uff0cclass_suite \u7531\u7c7b\u6210\u5458\uff0c\u65b9\u6cd5\uff0c\u6570\u636e\u5c5e\u6027\u7ec4\u6210\u3002\u5982\uff1a\n  <\/p>\n<pre><code>class Test:    \"\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u7c7b\"    def __init__(self):        self.__ivalue = 5    def getvalue(self):        return self.__ivalue<\/code><\/pre>\n<p>\n   \u5176\u4e2d\uff0c<br \/>\n   <code><br \/>\n    __init__<br \/>\n   <\/code><br \/>\n   \u4e3a\u521d\u59cb\u5316\u51fd\u6570\uff0c\u76f8\u5f53\u4e8e\u6784\u9020\u51fd\u6570\u3002\n  <\/p>\n<p>\n   <strong><br \/>\n    \u8bbf\u95ee\u6743\u9650\uff1a<br \/>\n   <\/strong>\n  <\/p>\n<ul>\n<li>\n    <code><br \/>\n     __foo__<br \/>\n    <\/code><br \/>\n    \uff1a\u5b9a\u4e49\u7684\u662f\u7279\u6b8a\u65b9\u6cd5\uff0c\u4e00\u822c\u662f\u7cfb\u7edf\u5b9a\u4e49\u540d\u5b57\uff0c\u7c7b\u4f3c<br \/>\n    <code><br \/>\n     __init__<br \/>\n    <\/code><br \/>\n    () \u4e4b\u7c7b\u7684\u3002\n   <\/li>\n<li>\n    <code><br \/>\n     _foo<br \/>\n    <\/code><br \/>\n    \uff1a\u4ee5\u5355\u4e0b\u5212\u7ebf\u5f00\u5934\u7684\u8868\u793a\u7684\u662f protected \u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u5373\u4fdd\u62a4\u7c7b\u578b\u53ea\u80fd\u5141\u8bb8\u5176\u672c\u8eab\u4e0e\u5b50\u7c7b\u8fdb\u884c\u8bbf\u95ee\uff0c\u4e0d\u80fd\u7528\u4e8e from module import *\u3002\n   <\/li>\n<li>\n    <code><br \/>\n     __foo<br \/>\n    <\/code><br \/>\n    \uff1a\u53cc\u4e0b\u5212\u7ebf\u7684\u8868\u793a\u7684\u662f\u79c1\u6709\u7c7b\u578b\uff08private\uff09\u7684\u53d8\u91cf\uff0c\u53ea\u80fd\u662f\u5141\u8bb8\u8fd9\u4e2a\u7c7b\u672c\u8eab\u8fdb\u884c\u8bbf\u95ee\u4e86\u3002\n   <\/li>\n<\/ul>\n<p>\n   <strong><br \/>\n    \u7c7b\u7684\u7ee7\u627f\uff1a<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   \u7ee7\u627f\u7684\u8bed\u6cd5\u7ed3\u6784\u5982\u4e0b\uff1a\n  <\/p>\n<pre><code>class \u6d3e\u751f\u7c7b\u540d\uff08\u57fa\u7c7b\u540d\uff09\uff1a    \u7c7b\u4f53<\/code><\/pre>\n<p>\n   Python \u4e2d\u7ee7\u627f\u4e2d\u7684\u4e00\u4e9b\u7279\u70b9\uff1a\n  <\/p>\n<ul>\n<li>\n    \u5728\u7ee7\u627f\u4e2d\u57fa\u7c7b\u7684\u6784\u9020\uff08<br \/>\n    <code><br \/>\n     __init__()<br \/>\n    <\/code><br \/>\n    \u65b9\u6cd5\uff09\u4e0d\u4f1a\u88ab\u81ea\u52a8\u8c03\u7528\uff0c\u5b83\u9700\u8981\u5728\u5176\u6d3e\u751f\u7c7b\u7684\u6784\u9020\u4e2d\u4eb2\u81ea\u4e13\u95e8\u8c03\u7528\u3002\n   <\/li>\n<li>\n    \u5728\u8c03\u7528\u57fa\u7c7b\u7684\u65b9\u6cd5\u65f6\uff0c\u9700\u8981\u4f7f\u7528 super() \u524d\u7f00\u3002\n   <\/li>\n<li>\n    Python \u603b\u662f\u9996\u5148\u67e5\u627e\u5bf9\u5e94\u7c7b\u578b\u7684\u65b9\u6cd5\uff0c\u5982\u679c\u5b83\u4e0d\u80fd\u5728\u6d3e\u751f\u7c7b\u4e2d\u627e\u5230\u5bf9\u5e94\u7684\u65b9\u6cd5\uff0c\u5b83\u624d\u5f00\u59cb\u5230\u57fa\u7c7b\u4e2d\u9010\u4e2a\u67e5\u627e\uff08\u5148\u5728\u672c\u7c7b\u4e2d\u67e5\u627e\u8c03\u7528\u7684\u65b9\u6cd5\uff0c\u627e\u4e0d\u5230\u624d\u53bb\u57fa\u7c7b\u4e2d\u627e\uff09\u3002\n   <\/li>\n<\/ul>\n<p>\n   \u5982\u679c\u5728\u7ee7\u627f\u5143\u7ec4\u4e2d\u5217\u4e86\u4e00\u4e2a\u4ee5\u4e0a\u7684\u7c7b\uff0c\u90a3\u4e48\u5b83\u5c31\u88ab\u79f0\u4f5c\u201c\u591a\u91cd\u7ee7\u627f\u201d\u3002\n  <\/p>\n<p>\n   <strong><br \/>\n    \u57fa\u7840\u91cd\u8f7d\u65b9\u6cd5<br \/>\n   <\/strong>\n  <\/p>\n<p>\n   Python \u7684\u7c7b\u4e2d\u6709\u5f88\u591a\u5185\u7f6e\u7684\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u91cd\u5199\u8fd9\u4e9b\u65b9\u6cd5\u6765\u5b9e\u73b0\u4e00\u4e9b\u7279\u6b8a\u7684\u529f\u80fd\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u6709\uff1a\n  <\/p>\n<table>\n<thead>\n<tr>\n<th>\n      \u5e8f\u53f7\n     <\/th>\n<th>\n      \u65b9\u6cd5\n     <\/th>\n<th>\n      \u63cf\u8ff0\n     <\/th>\n<th>\n      \u7b80\u5355\u7684\u8c03\u7528\n     <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n      1\n     <\/td>\n<td>\n      <code><br \/>\n       __init__<br \/>\n      <\/code><br \/>\n      (self [,args&#8230;] )\n     <\/td>\n<td>\n      \u6784\u9020\u51fd\u6570\n     <\/td>\n<td>\n      obj = className(args)\n     <\/td>\n<\/tr>\n<tr>\n<td>\n      2\n     <\/td>\n<td>\n      <code><br \/>\n       __del__<br \/>\n      <\/code><br \/>\n      (self)\n     <\/td>\n<td>\n      \u6790\u6784\u65b9\u6cd5, \u5220\u9664\u4e00\u4e2a\u5bf9\u8c61\n     <\/td>\n<td>\n      del obj\n     <\/td>\n<\/tr>\n<tr>\n<td>\n      3\n     <\/td>\n<td>\n      <code><br \/>\n       __repr__<br \/>\n      <\/code><br \/>\n      (self)\n     <\/td>\n<td>\n      \u8f6c\u5316\u4e3a\u4f9b\u89e3\u91ca\u5668\u8bfb\u53d6\u7684\u5f62\u5f0f\n     <\/td>\n<td>\n      repr(obj)\n     <\/td>\n<\/tr>\n<tr>\n<td>\n      4\n     <\/td>\n<td>\n      <code><br \/>\n       __str__<br \/>\n      <\/code><br \/>\n      (self)\n     <\/td>\n<td>\n      \u7528\u4e8e\u5c06\u503c\u8f6c\u5316\u4e3a\u9002\u4e8e\u4eba\u9605\u8bfb\u7684\u5f62\u5f0f\n     <\/td>\n<td>\n      str(obj)\n     <\/td>\n<\/tr>\n<tr>\n<td>\n      5\n     <\/td>\n<td>\n      <code><br \/>\n       __cmp__<br \/>\n      <\/code><br \/>\n      (self, x)\n     <\/td>\n<td>\n      \u5bf9\u8c61\u6bd4\u8f83\n     <\/td>\n<td>\n      cmp(obj, x)\n     <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>\n   Demo \u8ba9\u4f60\u987f\u609f<br \/>\n  <\/h5>\n<p>\n   \u6211\u4eec\u5c06\u4e00\u6bb5 Java \u7684\u4ee3\u7801\u5bf9\u5e94\u5230 Python \u4e2d\u6765\u5b9e\u73b0\uff0c\u8fdb\u884c\u5bf9\u6bd4\u9605\u8bfb\uff0c\u76f8\u4fe1\u5f88\u5feb\u5c31\u80fd\u660e\u767d\u5176\u4e2d\u7684\u7528\u6cd5\u3002Java \u4ee3\u7801\u5982\u4e0b\uff1a\n  <\/p>\n<pre><code>class Person {    public static int visited;    Person(String name, int age, float height) {        this.name = name;        this.age = age;        this.height = height;    }    public String getName() {        return name;    }    public int getAge() {        return age;    }    public void showInfo() {        System.out.println(\"name:\" + name);        System.out.println(\"age:\" + age);        System.out.println(\"height:\" + height);        System.out.println(\"visited:\" + visited);        Person.visited ++;    }    private String name;    protected int age;    public  float height;}class Teacher extends Person {    Teacher(String name, int age, float height) {        super(name, age, height);    }    public String getTitle() {        return title;    }    public void setTitle(String title) {        this.title = title;    }    public void showInfo() {        System.out.println(\"title:\" + title);        super.showInfo();    }    private String title;}public class Test {    public static void main(String args[]) {        Person tony = new Person(\"Tony\", 25, 1.77f);        tony.showInfo();        System.out.println();        Teacher jenny = new Teacher(\"Jenny\", 34, 1.68f);        jenny.setTitle(\"\u6559\u6388\");        jenny.showInfo();    }}<\/code><\/pre>\n<p>\n   \u5bf9\u5e94\u7684 Python \u4ee3\u7801\uff1a\n  <\/p>\n<pre><code>class Person:    \"\u4eba\"    visited = 0    def __init__(self, name, age, height):        self.__name = name        self._age = age        self.height = height    def getName(self):        return self.__name    def getAge(self):        return self._age    def showInfo(self):        print(\"name:\", self.__name)        print(\"age:\", self._age)        print(\"height:\", self.height)        print(\"visited:\", self.visited)        Person.visited = Person.visited +1class Teacher(Person):    \"\u8001\u5e08\"    def __init__(self, name, age, height):        super().__init__(name, age, height)        self.__title = None    def getTitle(self):        return self.__title    def setTitle(self, title):        self.__title = title    def showInfo(self):        print(\"title:\", self.__title)        super().showInfo()def testPerson():    \"\u6d4b\u8bd5\u65b9\u6cd5\"    tony = Person(\"Tony\", 25, 1.77)    tony.showInfo()    print();    jenny = Teacher(\"Jenny\", 34, 1.68);    jenny.setTitle(\"\u6559\u6388\");    jenny.showInfo();testPerson()<\/code><\/pre>\n<p>\n   \u81ea\u5df1\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u4f1a\u53d1\u73b0\u7ed3\u679c\u662f\u4e00\u6837\u7684\uff1a\n  <\/p>\n<pre><code>name: Tonyage: 25height: 1.77visited: 0title: \u6559\u6388name: Jennyage: 34height: 1.68visited: 1<\/code><\/pre>\n<h4>\n   \u91cd\u8981\u8bf4\u660e<br \/>\n  <\/h4>\n<ul>\n<li>\n    \u4e3a\u4e86\u964d\u4f4e\u7a0b\u5e8f\u590d\u6742\u5ea6\uff0c\u672c\u7cfb\u5217\u6587\u7ae0\u4e2d\u7528\u5230\u7684\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u5747\u4e0d\u8003\u8651\u591a\u7ebf\u7a0b\u5b89\u5168\uff0c\u671b\u501f\u9274 Demo \u7684\u8bfb\u8005\u6ce8\u610f\u3002\n   <\/li>\n<li>\n    \u672c\u7cfb\u5217\u6240\u6709 Demo \u5747\u662f\u5728 Python 3.6.3 \u4e0b\u7f16\u5199\u7684\uff0cPython 3.0 \u4ee5\u4e0a\u5e94\u8be5\u90fd\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\u3002\n   <\/li>\n<\/ul>\n<blockquote>\n<p>\n    <a href=\"https:\/\/gitbook.cn\/m\/mazi\/comp\/column?columnId=5b26040ac81ac568fcf64ea3&amp;utm_source=lwfsd001\" rel=\"nofollow\"><br \/>\n     \u70b9\u51fb\u4e86\u89e3\u66f4\u591a\u300a\u767d\u8bdd\u8bbe\u8ba1\u6a21\u5f0f 28 \u8bb2\u300b<br \/>\n    <\/a>\n   <\/p>\n<\/blockquote>\n<h6>\n   <strong><br \/>\n    \u7b2c01\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u76d1\u542c\u6a21\u5f0f\u2014\u2014\u4e00\u5751\u7239\u7684\u70ed\u6c34\u5668<br \/>\n   <\/strong><br \/>\n  <\/h6>\n<\/p>\n<div class=\"toc\">\n<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u7528\u7a0b\u5e8f\u6765\u6a21\u62df\u751f\u6d3b<br \/>\n         <\/a>\n        <\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u4ece\u5267\u60c5\u4e2d\u601d\u8003\u76d1\u542c\u6a21\u5f0f<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u76d1\u542c\u6a21\u5f0f<br \/>\n           <\/a>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u76d1\u542c\u6a21\u5f0f\u7684\u6a21\u578b\u62bd\u8c61<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u4ee3\u7801\u6846\u67b6<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u7c7b\u56fe<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u57fa\u4e8e\u6846\u67b6\u7684\u5b9e\u73b0<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u6a21\u578b\u8bf4\u660e<br \/>\n           <\/a><\/p>\n<ul>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              \u8bbe\u8ba1\u8981\u70b9<br \/>\n             <\/a>\n            <\/li>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              \u63a8\u6a21\u578b\u548c\u62c9\u6a21\u578b<br \/>\n             <\/a>\n            <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u5e94\u7528\u573a\u666f<br \/>\n         <\/a>\n        <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul><\/div>\n<p>\n   \u3010\u6545\u4e8b\u5267\u60c5\u3011\n  <\/p>\n<blockquote>\n<p>\n    \u521a\u521a\u5927\u5b66\u6bd5\u4e1a\u7684 Tony \u53ea\u8eab\u6765\u5230\u5317\u4eac\u8fd9\u4e2a\u7855\u5927\u7684\u57ce\u5e02\uff0c\u5f00\u59cb\u4e86\u5317\u6f02\u7684\u751f\u6d3b\u3002\u4f46\u521a\u521a\u6bd5\u4e1a\u7684\u4ed6\u8eab\u65e0\u7edd\u6280\u3001\u5305\u65e0\u5206\u6587\uff0c\u4e3a\u4e86\u751f\u6d3b\u53ea\u80fd\u4f4f\u5728\u6c99\u6cb3\u9547\u4e00\u4e2a\u504f\u50fb\u7684\u6751\u5b50\u91cc\uff0c\u6bcf\u5929\u5750\u7740\u7a0b\u5e8f\u5458\u4e13\u7ebf\uff0813\u53f7\u7ebf\uff09\u6765\u56de\u7a7f\u68ad\u4e8e\u660c\u5e73\u533a\u4e0e\u897f\u57ce\u533a\u2026\u2026\n   <\/p>\n<p>\n    \u5728\u4e00\u4e2a\u5bd2\u51b7\u7684\u51ac\u5929\uff0c\u4e0b\u73ed\u4e4b\u540e\u8981\u57502\u4e2a\u5c0f\u65f6\u7684\u5730\u94c1+\u516c\u4ea4\u624d\u80fd\u56de\u5230\u4f4f\u5904\uff0cTony \u62d6\u7740\u75b2\u60eb\u7684\u8eab\u4f53\u56de\u5230\u5bb6\u3002\u51c6\u5907\u6d17\u4e00\u4e2a\u70ed\u6c34\u6fa1\u6696\u6696\u8eab\u4f53\uff0c\u8010\u4f55\u7b80\u964b\u7684\u623f\u5b50\u4e2d\u7528\u7684\u8fd8\u662f90\u5e74\u4ee3\u7684\u70ed\u6c34\u5668\u3002\u56e0\u4e3a\u70ed\u6c34\u5668\u6ca1\u6709\u8b66\u62a5\u66f4\u6ca1\u6709\u81ea\u52a8\u5207\u6362\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u6240\u4ee5\u70e7\u70ed\u6c34\u5fc5\u987b\u5f97\u5b88\u7740\uff1b\u4e0d\u7136\u65f6\u95f4\u957f\u4e86\u6210\u6740\u732a\u70eb\uff0c\u65f6\u95f4\u77ed\u4e86\u53c8\u51b7\u6210\u72d7\u3002\u65e0\u5948\u7684 Tony \u80cc\u9760\u7740\u5899\uff0c\u5934\u671b\u7740\u5929\u82b1\u677f\uff0c\u6df1\u591c\u4e2d\u505a\u8d77\u4e86\u767d\u65e5\u68a6\uff1a\u4e00\u5b9a\u8981\u52aa\u529b\u5de5\u4f5c\uff0c\u8fc7\u4e24\u4e2a\u6708\u6211\u5c31\u53ef\u4ee5\u81ea\u5df1\u4e70\u4e00\u4e2a\u667a\u80fd\u70ed\u6c34\u5668\u4e86\uff1a\u6c34\u70e7\u597d\u4e86\u5c31\u53d1\u4e00\u4e2a\u8b66\u62a5\uff0c\u6211\u5c31\u53ef\u4ee5\u76f4\u63a5\u53bb\u6d17\u64cd\u3002\u8fd8\u8981\u80fd\u81ea\u5df1\u8bbe\u5b9a\u6a21\u5f0f\uff0c\u65e2\u53ef\u4ee5\u70e7\u5f00\u4e86\u7528\u6765\u559d\uff0c\u53ef\u4ee5\u70e7\u6696\u4e86\u7528\u6765\u6d17\u6fa1\u2026\u2026\n   <\/p>\n<\/blockquote>\n<h4>\n   \u7528\u7a0b\u5e8f\u6765\u6a21\u62df\u751f\u6d3b<br \/>\n  <\/h4>\n<p>\n   Tony \u9677\u5165\u767d\u65e5\u68a6\u4e2d\u2026\u2026\u4ed6\u7684\u68a6\u867d\u7136\u5728\u73b0\u5b9e\u4e16\u754c\u91cc\u4e0d\u80fd\u7acb\u5373\u5b9e\u73b0\uff0c\u4f46\u5728\u7a0b\u5e8f\u4e16\u754c\u91cc\u53ef\u4ee5\u3002\u7a0b\u5e8f\u6765\u6e90\u4e8e\u751f\u6d3b\uff0c\u4e0b\u9762\u6211\u4eec\u5c31\u7528\u4ee3\u7801\u6765\u6a21\u62df Tony \u7684\u767d\u65e5\u68a6\u3002\n  <\/p>\n<p>\n   \u6e90\u7801\u793a\u4f8b\uff1a\n  <\/p>\n<pre><code>class WaterHeater:    \"\u70ed\u6c34\u5668\uff1a\u6218\u80dc\u5bd2\u51ac\u7684\u6709\u5229\u6b66\u5668\"    def __init__(self):        self.__observers = []        self.__temperature = 25    def getTemperature(self):        return self.__temperature    def setTemperature(self, temperature):        self.__temperature = temperature        print(\"current temperature is:\", self.__temperature)        self.notifies()    def addObserver(self, observer):        self.__observers.append(observer)    def notifies(self):        for o in self.__observers:            o.update(self)class Observer:    \"\u6d17\u6fa1\u6a21\u5f0f\u548c\u996e\u7528\u6a21\u5f0f\u7684\u7236\u7c7b\"    def update(self, waterHeater):        passclass WashingMode(Observer):    \"\u8be5\u6a21\u5f0f\u7528\u4e8e\u6d17\u6fa1\u7528\"    def update(self, waterHeater):        if waterHeater.getTemperature() &gt;= 50 and waterHeater.getTemperature() &lt; 70:            print(\"\u6c34\u5df2\u70e7\u597d\uff0c\u6e29\u5ea6\u6b63\u597d\uff01\u53ef\u4ee5\u7528\u6765\u6d17\u6fa1\u4e86\u3002\")class DrinkingMode(Observer):    \"\u8be5\u6a21\u5f0f\u7528\u4e8e\u996e\u7528\"    def update(self, waterHeater):        if waterHeater.getTemperature() &gt;= 100:            print(\"\u6c34\u5df2\u70e7\u5f00\uff01\u53ef\u4ee5\u7528\u6765\u996e\u7528\u4e86\u3002\")<\/code><\/pre>\n<p>\n   \u6d4b\u8bd5\u4ee3\u7801\uff1a\n  <\/p>\n<pre><code>def testWaterHeater():    heater = WaterHeater()    washingObser = WashingMode()    drinkingObser = DrinkingMode()    heater.addObserver(washingObser)    heater.addObserver(drinkingObser)    heater.setTemperature(40)    heater.setTemperature(60)    heater.setTemperature(100)<\/code><\/pre>\n<p>\n   \u8f93\u51fa\u7ed3\u679c\uff1a\n  <\/p>\n<pre><code>current temperature is: 40current temperature is: 60\u6c34\u5df2\u70e7\u597d\uff0c\u6e29\u5ea6\u6b63\u597d\uff01\u53ef\u4ee5\u7528\u6765\u6d17\u6fa1\u4e86\u3002current temperature is: 100\u6c34\u5df2\u70e7\u5f00\uff01\u53ef\u4ee5\u7528\u6765\u996e\u7528\u4e86\u3002<\/code><\/pre>\n<h4>\n   \u4ece\u5267\u60c5\u4e2d\u601d\u8003\u76d1\u542c\u6a21\u5f0f<br \/>\n  <\/h4>\n<p>\n   \u8fd9\u4e2a\u4ee3\u7801\u975e\u5e38\u7b80\u5355\uff0c\u6c34\u70e7\u523050-70\u5ea6\u65f6\uff0c\u4f1a\u53d1\u51fa\u8b66\u544a\uff1a\u53ef\u4ee5\u7528\u6765\u6d17\u6fa1\u4e86\uff01\u70e7\u5230100\u5ea6\u4e5f\u4f1a\u53d1\u51fa\u8b66\u544a\uff1a\u53ef\u4ee5\u7528\u6765\u559d\u4e86\uff01\u5728\u8fd9\u91cc\u6d17\u6fa1\u6a21\u5f0f\u548c\u996e\u7528\u6a21\u5f0f\u626e\u6f14\u4e86\u76d1\u542c\u7684\u89d2\u8272\uff0c\u800c\u70ed\u6c34\u5668\u5219\u662f\u88ab\u76d1\u542c\u7684\u5bf9\u8c61\u3002\u4e00\u65e6\u70ed\u6c34\u5668\u4e2d\u7684\u6c34\u6e29\u5ea6\u53d1\u751f\u53d8\u5316\uff0c\u76d1\u542c\u8005\u90fd\u80fd\u53ca\u65f6\u77e5\u9053\u5e76\u505a\u51fa\u76f8\u5e94\u7684\u5224\u65ad\u548c\u52a8\u4f5c\u3002\u5176\u5b9e\u8fd9\u5c31\u662f\u7a0b\u5e8f\u8bbe\u8ba1\u4e2d\u76d1\u542c\u6a21\u5f0f\u7684\u751f\u52a8\u5c55\u73b0\u3002\n  <\/p>\n<h5>\n   \u76d1\u542c\u6a21\u5f0f<br \/>\n  <\/h5>\n<p>\n   \u76d1\u542c\u6a21\u5f0f\u53c8\u540d\u89c2\u5bdf\u8005\u6a21\u5f0f\uff0c\u987e\u540d\u601d\u610f\u5c31\u662f\u89c2\u5bdf\u4e0e\u88ab\u89c2\u5bdf\u7684\u5173\u7cfb\uff0c\u6bd4\u5982\u4f60\u5728\u70e7\u5f00\u6c34\u5f97\u65f6\u65f6\u770b\u7740\u5b83\u5f00\u6ca1\u5f00\uff0c\u4f60\u5c31\u662f\u89c2\u5bdf\u8005\uff0c\u6c34\u5c31\u662f\u88ab\u89c2\u5bdf\u8005\uff1b\u518d\u6bd4\u5982\u8bf4\u4f60\u5728\u5e26\u5c0f\u5b69\uff0c\u4f60\u5173\u6ce8\u5979\u662f\u4e0d\u662f\u997f\u4e86\uff0c\u662f\u4e0d\u662f\u559d\u4e86\uff0c\u662f\u4e0d\u662f\u6492\u5c3f\u4e86\uff0c\u4f60\u5c31\u662f\u89c2\u5bdf\u8005\uff0c\u5c0f\u5b69\u5c31\u662f\u88ab\u89c2\u5bdf\u8005\u3002\n  <\/p>\n<p>\n   \u89c2\u5bdf\u8005\u6a21\u5f0f\u662f\u5bf9\u8c61\u7684\u884c\u4e3a\u6a21\u5f0f\uff0c\u53c8\u53eb\u53d1\u5e03-\u8ba2\u9605\uff08Publish\/Subscribe\uff09\u6a21\u5f0f\u3001\u6a21\u578b-\u89c6\u56fe\uff08Model\/View\uff09\u6a21\u5f0f\u3001\u6e90-\u76d1\u542c\u5668\uff08Source\/Listener\uff09\u6a21\u5f0f\u6216\u4ece\u5c5e\u8005\uff08Dependents\uff09\u6a21\u5f0f\u3002\u5f53\u4f60\u770b\u8fd9\u4e9b\u6a21\u5f0f\u7684\u65f6\u5019\uff0c\u4e0d\u8981\u89c9\u5f97\u964c\u751f\uff0c\u5b83\u4eec\u5c31\u662f\u89c2\u5bdf\u8005\u6a21\u5f0f\u3002\n  <\/p>\n<p>\n   \u89c2\u5bdf\u8005\u6a21\u5f0f\u4e00\u822c\u662f\u4e00\u79cd\u4e00\u5bf9\u591a\u7684\u5173\u7cfb\uff0c\u53ef\u4ee5\u6709\u4efb\u610f\u4e2a\uff08\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u89c2\u5bdf\u8005\u5bf9\u8c61\u540c\u65f6\u76d1\u542c\u67d0\u4e00\u4e2a\u5bf9\u8c61\u3002\u76d1\u542c\u7684\u5bf9\u8c61\u53eb\u89c2\u5bdf\u8005\uff08\u540e\u9762\u63d0\u5230\u76d1\u542c\u8005\uff0c\u5176\u5b9e\u5c31\u6307\u89c2\u5bdf\u8005\uff0c\u4e24\u8005\u662f\u7b49\u4ef7\u7684\uff09\uff0c\u88ab\u76d1\u542c\u7684\u5bf9\u8c61\u53eb\u88ab\u89c2\u5bdf\u8005\uff08Observable\uff0c\u4e5f\u53eb\u4e3b\u9898 Subject\uff09\u3002\u88ab\u89c2\u5bdf\u8005\u5bf9\u8c61\u5728\u72b6\u6001\u6216\u5185\u5bb9\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u4f1a\u901a\u77e5\u6240\u6709\u89c2\u5bdf\u8005\u5bf9\u8c61\uff0c\u4f7f\u5b83\u4eec\u80fd\u591f\u505a\u51fa\u76f8\u5e94\u7684\u53d8\u5316\uff08\u5982\u81ea\u52a8\u66f4\u65b0\u81ea\u5df1\u7684\u4fe1\u606f\uff09\u3002\n  <\/p>\n<h4>\n   \u76d1\u542c\u6a21\u5f0f\u7684\u6a21\u578b\u62bd\u8c61<br \/>\n  <\/h4>\n<h5>\n   \u4ee3\u7801\u6846\u67b6<br \/>\n  <\/h5>\n<p>\n   \u4e0a\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u8fd8\u662f\u76f8\u5bf9\u6bd4\u8f83\u7c97\u7cd9\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u5b83\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u91cd\u6784\u548c\u4f18\u5316\uff0c\u62bd\u8c61\u51fa\u76d1\u542c\u6a21\u5f0f\u7684\u6846\u67b6\u6a21\u578b\u3002\n  <\/p>\n<pre><code>class Observer:    \"\u89c2\u5bdf\u8005\u7684\u57fa\u7c7b\"    def update(self, observer, object):        passclass Observable:    \"\u88ab\u89c2\u5bdf\u8005\u7684\u57fa\u7c7b\"    def __init__(self):        self.__observers = []    def addObserver(self, observer):        self.__observers.append(observer)    def removeObserver(self, observer):        self.__observers.remove(observer)    def notifyObservers(self, object = 0):        for o in self.__observers:            o.update(self, object)<\/code><\/pre>\n<h5>\n   \u7c7b\u56fe<br \/>\n  <\/h5>\n<p>\n   \u4e0a\u9762\u7684\u4ee3\u7801\u6846\u67b6\u53ef\u7528\u7c7b\u56fe\u8868\u793a\u5982\u4e0b\uff1a\n  <\/p>\n<\/p>\n<p>\n   addObserver\uff0cremoveObserver \u5206\u522b\u7528\u4e8e\u6dfb\u52a0\u548c\u5220\u9664\u89c2\u5bdf\u8005\uff0cnotifyObservers \u7528\u4e8e\u5185\u5bb9\u6216\u72b6\u6001\u53d8\u5316\u65f6\u901a\u77e5\u6240\u6709\u7684\u89c2\u5bdf\u8005\u3002\u56e0\u4e3a Observable \u7684 notifyObservers \u4f1a\u8c03\u7528 Observer \u7684 update \u65b9\u6cd5\uff0c\u6240\u6709\u89c2\u5bdf\u8005\u4e0d\u9700\u8981\u5173\u5fc3\u88ab\u89c2\u5bdf\u7684\u5bf9\u8c61\u4ec0\u4e48\u65f6\u5019\u4f1a\u53d1\u751f\u53d8\u5316\uff0c\u53ea\u8981\u6709\u53d8\u5316\u5c31\u662f\u81ea\u52a8\u8c03\u7528 update\uff0c\u53ea\u9700\u8981\u5173\u6ce8 update \u5b9e\u73b0\u5c31\u53ef\u4ee5\u4e86\u3002\n  <\/p>\n<h5>\n   \u57fa\u4e8e\u6846\u67b6\u7684\u5b9e\u73b0<br \/>\n  <\/h5>\n<p>\n   \u6709\u4e86\u4e0a\u9762\u7684\u4ee3\u7801\u6846\u67b6\u4e4b\u540e\uff0c\u6211\u4eec\u8981\u5b9e\u73b0\u793a\u4f8b\u4ee3\u7801\u7684\u529f\u80fd\u5c31\u4f1a\u66f4\u7b80\u5355\u4e86\u3002\u6700\u5f00\u59cb\u7684\u793a\u4f8b\u4ee3\u7801\u6211\u4eec\u5047\u8bbe\u5b83\u4e3a version 1.0\uff0c\u90a3\u4e48\u518d\u770b\u770b\u57fa\u4e8e\u6846\u67b6\u7684 version 2.0 \u5427\u3002\n  <\/p>\n<pre><code>class WaterHeater(Observable):    \"\u70ed\u6c34\u5668\uff1a\u6218\u80dc\u5bd2\u51ac\u7684\u6709\u5229\u6b66\u5668\"    def __init__(self):        super().__init__()        self.__temperature = 25    def getTemperature(self):        return self.__temperature    def setTemperature(self, temperature):        self.__temperature = temperature        print(\"current temperature is:\", self.__temperature)        self.notifyObservers()class WashingMode(Observer):    \"\u8be5\u6a21\u5f0f\u7528\u4e8e\u6d17\u6fa1\u7528\"    def update(self, observable, object):        if isinstance(observable,                      WaterHeater) and observable.getTemperature() &gt;= 50 and observable.getTemperature() &lt; 70:            print(\"\u6c34\u5df2\u70e7\u597d\uff0c\u6e29\u5ea6\u6b63\u597d\uff01\u53ef\u4ee5\u7528\u6765\u6d17\u6fa1\u4e86\u3002\")class DrinkingMode(Observer):    \"\u8be5\u6a21\u5f0f\u7528\u4e8e\u996e\u7528\"    def update(self, observable, object):        if isinstance(observable, WaterHeater) and observable.getTemperature() &gt;= 100:            print(\"\u6c34\u5df2\u70e7\u5f00\uff01\u53ef\u4ee5\u7528\u6765\u996e\u7528\u4e86\u3002\")<\/code><\/pre>\n<p>\n   \u6d4b\u8bd5\u4ee3\u7801\u4e0d\u7528\u53d8\u3002\u81ea\u5df1\u8dd1\u4e00\u4e0b\uff0c\u4f1a\u53d1\u73b0\u8f93\u51fa\u7ed3\u679c\u548c\u4e4b\u524d\u7684\u662f\u4e00\u6837\u7684\u3002\n  <\/p>\n<h5>\n   \u6a21\u578b\u8bf4\u660e<br \/>\n  <\/h5>\n<h6>\n   <strong><br \/>\n    \u8bbe\u8ba1\u8981\u70b9<br \/>\n   <\/strong><br \/>\n  <\/h6>\n<p>\n   \u5728\u8bbe\u8ba1\u89c2\u5bdf\u8005\u6a21\u5f0f\u7684\u7a0b\u5e8f\u65f6\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a\n  <\/p>\n<ol>\n<li>\n    \u8981\u660e\u786e\u8c01\u662f\u89c2\u5bdf\u8005\u8c01\u662f\u88ab\u89c2\u5bdf\u8005\uff0c\u53ea\u8981\u660e\u767d\u8c01\u662f\u5173\u6ce8\u5bf9\u8c61\uff0c\u95ee\u9898\u4e5f\u5c31\u660e\u767d\u4e86\u3002\u4e00\u822c\u89c2\u5bdf\u8005\u4e0e\u88ab\u89c2\u5bdf\u8005\u4e4b\u95f4\u662f\u591a\u5bf9\u4e00\u7684\u5173\u7cfb\uff0c\u4e00\u4e2a\u88ab\u89c2\u5bdf\u5bf9\u8c61\u53ef\u4ee5\u6709\u591a\u4e2a\u76d1\u542c\u5bf9\u8c61(\u89c2\u5bdf\u8005)\u3002\u5982\u4e00\u4e2a\u7f16\u8f91\u6846\uff0c\u6709\u9f20\u6807\u70b9\u51fb\u7684\u76d1\u542c\u8005\uff0c\u4e5f\u6709\u952e\u76d8\u7684\u76d1\u542c\u8005\uff0c\u8fd8\u6709\u5185\u5bb9\u6539\u53d8\u7684\u76d1\u542c\u8005\u3002\n   <\/li>\n<li>\n    Observable \u5728\u53d1\u9001\u5e7f\u64ad\u901a\u77e5\u7684\u65f6\u5019\uff0c\u65e0\u987b\u6307\u5b9a\u5177\u4f53\u7684 Observer\uff0cObserver \u53ef\u4ee5\u81ea\u5df1\u51b3\u5b9a\u662f\u5426\u8981\u8ba2\u9605 Subject \u7684\u901a\u77e5\u3002\n   <\/li>\n<li>\n    \u88ab\u89c2\u5bdf\u8005\u81f3\u5c11\u9700\u8981\u6709\u4e09\u4e2a\u65b9\u6cd5\uff1a\u6dfb\u52a0\u76d1\u542c\u8005\u3001\u79fb\u9664\u76d1\u542c\u8005\u3001\u901a\u77e5 Observer \u7684\u65b9\u6cd5\uff1b\u89c2\u5bdf\u8005\u81f3\u5c11\u8981\u6709\u4e00\u4e2a\u65b9\u6cd5\uff1a\u66f4\u65b0\u65b9\u6cd5\uff0c\u66f4\u65b0\u5f53\u524d\u7684\u5185\u5bb9\uff0c\u4f5c\u51fa\u76f8\u5e94\u7684\u5904\u7406\u3002\n   <\/li>\n<li>\n    \u6dfb\u52a0\u76d1\u542c\u8005\u3001\u79fb\u9664\u76d1\u542c\u8005\u5728\u4e0d\u540c\u7684\u6a21\u578b\u79f0\u8c13\u4e2d\u53ef\u80fd\u4f1a\u6709\u4e0d\u540c\u547d\u540d\uff0c\u5982\u89c2\u5bdf\u8005\u6a21\u578b\u4e2d\u4e00\u822c\uff0caddObserver\uff0cremoveObserver\uff1b\u5728\u6e90-\u76d1\u542c\u5668\uff08Source\/Listener\uff09\u6a21\u578b\u4e2d\u4e00\u822c\u662f attach\/detach\uff0c\u5e94\u7528\u5728\u684c\u9762\u7f16\u7a0b\u7684\u7a97\u53e3\u4e2d\uff0c\u8fd8\u53ef\u80fd\u662f attachWindow\/detachWindow\uff0c\u6216 Register\/UnRegister\u3002\u4e0d\u8981\u88ab\u540d\u79f0\u8ff7\u7cca\u4e86\uff0c\u4e0d\u7ba1\u4ed6\u4eec\u662f\u4ec0\u4e48\u540d\u79f0\uff0c\u5176\u5b9e\u529f\u80fd\u90fd\u662f\u4e00\u6837\u7684\uff0c\u5c31\u662f\u6dfb\u52a0\/\u5220\u9664\u89c2\u5bdf\u8005\u3002\n   <\/li>\n<\/ol>\n<h6>\n   <strong><br \/>\n    \u63a8\u6a21\u578b\u548c\u62c9\u6a21\u578b<br \/>\n   <\/strong><br \/>\n  <\/h6>\n<p>\n   \u89c2\u5bdf\u8005\u6a21\u5f0f\u6839\u636e\u5176\u4fa7\u91cd\u7684\u529f\u80fd\u8fd8\u53ef\u4ee5\u5206\u4e3a\u63a8\u6a21\u578b\u548c\u62c9\u6a21\u578b\u3002\n  <\/p>\n<p>\n   <strong><br \/>\n    \u63a8\u6a21\u578b<br \/>\n   <\/strong><br \/>\n   \uff1a\u88ab\u89c2\u5bdf\u8005\u5bf9\u8c61\u5411\u89c2\u5bdf\u8005\u63a8\u9001\u4e3b\u9898\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u4e0d\u7ba1\u89c2\u5bdf\u8005\u662f\u5426\u9700\u8981\uff0c\u63a8\u9001\u7684\u4fe1\u606f\u901a\u5e38\u662f\u4e3b\u9898\u5bf9\u8c61\u7684\u5168\u90e8\u6216\u90e8\u5206\u6570\u636e\u3002\u4e00\u822c\u8fd9\u79cd\u6a21\u578b\u7684\u5b9e\u73b0\u4e2d\uff0c\u4f1a\u628a\u88ab\u89c2\u5bdf\u8005\u5bf9\u8c61\u4e2d\u7684\u5168\u90e8\u6216\u90e8\u5206\u4fe1\u606f\u901a\u8fc7 update \u7684\u53c2\u6570\u4f20\u9012\u7ed9\u89c2\u5bdf\u8005 [update(Object obj) \uff0c\u901a\u8fc7 obj \u53c2\u6570\u4f20\u9012]\u3002\n  <\/p>\n<blockquote>\n<p>\n    \u5982\u67d0\u5e94\u7528 App \u7684\u670d\u52a1\u8981\u5728\u51cc\u66681:00\u5f00\u59cb\u8fdb\u884c\u7ef4\u62a4\uff0c1:00-2:00\u671f\u95f4\u6240\u6709\u670d\u52a1\u5c06\u4f1a\u6682\u505c\uff0c\u8fd9\u91cc\u4f60\u5c31\u9700\u8981\u5411\u6240\u6709\u7684 App \u5ba2\u6237\u7aef\u63a8\u9001\u5b8c\u6574\u7684\u901a\u77e5\u6d88\u606f\uff1a\u201c\u672c\u670d\u52a1\u5c06\u5728\u51cc\u66681:00\u5f00\u59cb\u8fdb\u884c\u7ef4\u62a4\uff0c1:00-2:00\u671f\u95f4\u6240\u6709\u670d\u52a1\u5c06\u4f1a\u6682\u505c\uff0c\u611f\u8c22\u60a8\u7684\u7406\u89e3\u548c\u652f\u6301\uff01\u201d \u4e0d\u7ba1\u7528\u6237\u60f3\u4e0d\u60f3\u77e5\u9053\uff0c\u4e5f\u4e0d\u7ba1\u7528\u6237\u4f1a\u4e0d\u4f1a\u5728\u8fd9\u6bb5\u671f\u95f4\u53bb\u8bbf\u95ee\uff0c\u6d88\u606f\u90fd\u9700\u8981\u88ab\u51c6\u786e\u65e0\u8bef\u5730\u901a\u77e5\u5230\u3002\u8fd9\u5c31\u662f\u5178\u578b\u7684\u63a8\u6a21\u578b\u7684\u5e94\u7528\u3002\n   <\/p>\n<\/blockquote>\n<p>\n   <strong><br \/>\n    \u62c9\u6a21\u578b<br \/>\n   <\/strong><br \/>\n   \uff1a\u88ab\u89c2\u5bdf\u8005\u5728\u901a\u77e5\u89c2\u5bdf\u8005\u7684\u65f6\u5019\uff0c\u53ea\u4f20\u9012\u5c11\u91cf\u4fe1\u606f\u3002\u5982\u679c\u89c2\u5bdf\u8005\u9700\u8981\u66f4\u5177\u4f53\u7684\u4fe1\u606f\uff0c\u7531\u89c2\u5bdf\u8005\u4e3b\u52a8\u5230\u88ab\u89c2\u5bdf\u8005\u5bf9\u8c61\u4e2d\u83b7\u53d6\uff0c\u76f8\u5f53\u4e8e\u662f\u89c2\u5bdf\u8005\u4ece\u88ab\u89c2\u5bdf\u8005\u5bf9\u8c61\u4e2d\u62c9\u6570\u636e\u3002\u4e00\u822c\u8fd9\u79cd\u6a21\u578b\u7684\u5b9e\u73b0\u4e2d\uff0c\u4f1a\u628a\u88ab\u89c2\u5bdf\u8005\u5bf9\u8c61\u81ea\u8eab\u901a\u8fc7 update \u65b9\u6cd5\u4f20\u9012\u7ed9\u89c2\u5bdf\u8005 [update(Observable observable )\uff0c\u901a\u8fc7 observable \u53c2\u6570\u4f20\u9012 ]\uff0c\u8fd9\u6837\u5728\u89c2\u5bdf\u8005\u9700\u8981\u83b7\u53d6\u6570\u636e\u7684\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u5f15\u7528\u6765\u83b7\u53d6\u4e86\u3002\n  <\/p>\n<blockquote>\n<p>\n    \u5982\u67d0\u5e94\u7528 App \u6709\u65b0\u7684\u7248\u672c\u63a8\u51fa\uff0c\u5219\u9700\u8981\u53d1\u9001\u4e00\u4e2a\u7248\u672c\u5347\u7ea7\u7684\u901a\u77e5\u6d88\u606f\uff0c\u800c\u8fd9\u4e2a\u901a\u77e5\u6d88\u606f\u53ea\u4f1a\u7b80\u5355\u5730\u5217\u51fa\u7248\u672c\u53f7\u548c\u4e0b\u8f7d\u5730\u5740\uff0c\u5982\u679c\u4f60\u9700\u8981\u5347\u7ea7\u4f60\u7684 App \u8fd8\u9700\u8981\u8c03\u7528\u4e0b\u8f7d\u63a5\u53e3\u53bb\u4e0b\u8f7d\u5b89\u88c5\u5305\u5b8c\u6210\u5347\u7ea7\u3002\u8fd9\u5176\u5b9e\u4e5f\u53ef\u4ee5\u7406\u89e3\u6210\u662f\u62c9\u6a21\u578b\u3002\n   <\/p>\n<\/blockquote>\n<p>\n   \u63a8\u6a21\u578b\u548c\u62c9\u6a21\u578b\u5176\u5b9e\u66f4\u591a\u7684\u662f\u8bed\u4e49\u548c\u903b\u8f91\u4e0a\u7684\u533a\u522b\u3002\u6211\u4eec\u4e0a\u9762\u7684\u4ee3\u7801\u6846\u67b6\uff0c\u4ece\u63a5\u53e3 [update(self, observer, object)] \u4e0a\u4f60\u5e94\u8be5\u77e5\u9053\u662f\u53ef\u4ee5\u540c\u65f6\u652f\u6301\u63a8\u6a21\u578b\u548c\u62c9\u6a21\u578b\u7684\u3002\u63a8\u6a21\u578b\u65f6\uff0cobserver \u53ef\u4ee5\u4f20\u7a7a\uff0c\u63a8\u9001\u7684\u4fe1\u606f\u5168\u90e8\u901a\u5e38 object \u4f20\u9012\uff1b\u62c9\u6a21\u578b\u65f6\uff0cobserver \u548c object \u90fd\u4f20\u9012\u6570\u636e\uff0c\u6216\u53ea\u4f20\u9012 observer\uff0c\u9700\u8981\u66f4\u5177\u4f53\u7684\u4fe1\u606f\u65f6\u901a\u8fc7 observer \u5f15\u7528\u53bb\u53d6\u6570\u636e\u3002\n  <\/p>\n<h4>\n   \u5e94\u7528\u573a\u666f<br \/>\n  <\/h4>\n<ol>\n<li>\n    \u5bf9\u4e00\u4e2a\u5bf9\u8c61\u72b6\u6001\u6216\u6570\u636e\u7684\u66f4\u65b0\u9700\u8981\u5176\u4ed6\u5bf9\u8c61\u540c\u6b65\u66f4\u65b0\uff0c\u6216\u8005\u4e00\u4e2a\u5bf9\u8c61\u7684\u66f4\u65b0\u9700\u8981\u4f9d\u8d56\u53e6\u4e00\u4e2a\u5bf9\u8c61\u7684\u66f4\u65b0\uff1b\n   <\/li>\n<li>\n    \u5bf9\u8c61\u4ec5\u9700\u8981\u5c06\u81ea\u5df1\u7684\u66f4\u65b0\u901a\u77e5\u7ed9\u5176\u4ed6\u5bf9\u8c61\u800c\u4e0d\u9700\u8981\u77e5\u9053\u5176\u4ed6\u5bf9\u8c61\u7684\u7ec6\u8282\uff0c\u5982\u6d88\u606f\u63a8\u9001\u3002\n   <\/li>\n<\/ol>\n<p>\n   \u5b66\u4e60\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u66f4\u5e94\u8be5\u9886\u609f\u5176\u8bbe\u8ba1\u601d\u60f3\uff0c\u4e0d\u5e94\u8be5\u5e94\u8be5\u5c40\u9650\u4e8e\u4ee3\u7801\u7684\u5c42\u9762\u3002 \u89c2\u5bdf\u8005\u6a21\u5f0f\u8fd8\u53ef\u4ee5\u7528\u4e8e\u7f51\u7edc\u4e2d\u7684\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\uff0c\u6bd4\u5982\u624b\u673a\u4e2d\u7684\u5404\u79cd App \u7684\u6d88\u606f\u63a8\u9001\uff0c\u670d\u52a1\u7aef\u662f\u88ab\u89c2\u5bdf\u8005\uff0c\u5404\u4e2a\u624b\u673a App \u662f\u89c2\u5bdf\u8005\uff0c\u4e00\u65e6\u670d\u52a1\u5668\u4e0a\u7684\u6570\u636e\uff08\u5982 App \u5347\u7ea7\u4fe1\u606f\uff09\u6709\u66f4\u65b0\uff0c\u5c31\u4f1a\u88ab\u63a8\u9001\u5230\u624b\u673a\u5ba2\u6237\u7aef\u3002\u5728\u8fd9\u4e2a\u5e94\u7528\u4e2d\u4f60\u4f1a\u53d1\u73b0\u670d\u52a1\u5668\u4ee3\u7801\u548c App \u5ba2\u6237\u7aef\u4ee3\u7801\u5176\u5b9e\u662f\u4e24\u5957\u5b8c\u5168\u4e0d\u4e00\u6837\u7684\u7684\u4ee3\u7801\uff0c\u5b83\u4eec\u662f\u901a\u8fc7\u7f51\u7edc\u63a5\u53e3\u8fdb\u884c\u901a\u8fc5\u7684\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u53ea\u662f\u505c\u7559\u5728\u4ee3\u7801\u5c42\u9762\u662f\u65e0\u6cd5\u7406\u89e3\u7684\uff01\n  <\/p>\n<blockquote>\n<p>\n    <a href=\"https:\/\/gitbook.cn\/m\/mazi\/comp\/column?columnId=5b26040ac81ac568fcf64ea3&amp;utm_source=lwfsd001\" rel=\"nofollow\"><br \/>\n     \u70b9\u51fb\u4e86\u89e3\u66f4\u591a\u300a\u767d\u8bdd\u8bbe\u8ba1\u6a21\u5f0f 28 \u8bb2\u300b<br \/>\n    <\/a>\n   <\/p>\n<\/blockquote>\n<h6>\n   <strong><br \/>\n    \u7b2c02\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u9002\u914d\u6a21\u5f0f\u2014\u2014\u8eab\u9ad8\u4e0d\u591f\u978b\u6765\u51d1<br \/>\n   <\/strong><br \/>\n  <\/h6>\n<\/p>\n<div class=\"toc\">\n<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u7528\u7a0b\u5e8f\u6765\u6a21\u62df\u751f\u6d3b<br \/>\n         <\/a>\n        <\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u4ece\u5267\u60c5\u4e2d\u601d\u8003\u9002\u914d\u5668\u6a21\u5f0f<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u9002\u914d\u5668\u6a21\u5f0f<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u8bbe\u8ba1\u601d\u60f3<br \/>\n           <\/a>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u9002\u914d\u5668\u6a21\u5f0f\u7684\u6a21\u578b\u62bd\u8c61<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u7c7b\u56fe<br \/>\n           <\/a>\n          <\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u6a21\u578b\u8bf4\u660e<br \/>\n         <\/a><\/p>\n<ul>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u8bbe\u8ba1\u8981\u70b9<br \/>\n           <\/a>\n          <\/li>\n<li>\n           <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n            \u4f18\u7f3a\u70b9<br \/>\n           <\/a><\/p>\n<ul>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              \u9002\u914d\u5668\u6a21\u5f0f\u7684\u4f18\u70b9<br \/>\n             <\/a>\n            <\/li>\n<li>\n             <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n              \u9002\u914d\u5668\u6a21\u5f0f\u7684\u7f3a\u70b9<br \/>\n             <\/a>\n            <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u5b9e\u6218\u5e94\u7528<br \/>\n         <\/a>\n        <\/li>\n<li>\n         <a href=\"#undefined\" rel=\"nofollow\"><br \/>\n          \u5e94\u7528\u573a\u666f<br \/>\n         <\/a>\n        <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul><\/div>\n<p>\n   \u3010\u6545\u4e8b\u5267\u60c5\u3011\n  <\/p>\n<blockquote>\n<p>\n    \u665a\u4e0a\u4e5d\u70b9\u534a\uff0cTony \u4e0a\u4e86\u5730\u94c1\uff0c\u51c6\u5907\u56de\u5bb6\uff0c\u6b63\u5de7\u8fd8\u6709\u4e00\u4e2a\u7a7a\u4f4d\uff0c\u8d76\u7d27\u8d70\u5411\u524d\u5750\u4e0b\u3002\u5de5\u4f5c\u4e00\u5929\u540e\uff0c\u75b2\u60eb\u4e0d\u582a\u7684\u4ed6\u6b63\u51c6\u5907\u5750\u7740\u6253\u4e2a\u76f9\u5c0f\u7761\u4e00\u4f1a\u513f\u3002\u8fd9\u65f6\u8fdb\u6765\u4e24\u4e2a\u5c0f\u59d1\u5a18\uff0c\u4e00\u4e2a\u5c0f\u5de7\u53ef\u7231\uff0c\u4e00\u4e2a\u8eab\u59ff\u66fc\u5999\uff1b\u5b09\u7b11\u5730\u804a\u7740\u5929\u8d70\u5230\u4e86 Tony \u7684\u524d\u9762\uff0cTony \u72b9\u8c6b\u4e86\u7247\u523b\u540e\u8fd8\u662f\u7ec5\u58eb\u822c\u5730\u7ed9\u5c0f\u5973\u5b69\u8ba9\u4e86\u4e2a\u5ea7\u2026\u2026\n   <\/p>\n<p>\n    \u4e24\u4e2a\u5c0f\u59d1\u5a18\u9053\u4e86\u58f0\u8c22\u8c22\uff0c\u4fbf\u6324\u5728\u4e00\u5757\u5750\u4e0b\u4e86\uff0c\u7ee7\u7eed\u6709\u8bf4\u6709\u7b11\u5730\u8c08\u8bba\u7740\u2026\u2026\n   <\/p>\n<p>\n    Amy\uff1a\u5468\u672b\u5728\u5546\u573a\u91cc\u770b\u5230\u4f60\u548c\u4e00\u4e2a\u5e05\u54e5\u5728\u4e00\u8d77\u3002\u597d\u4f60\u4e2a Nina\uff0c\u8131\u5355\u4e86\u4e5f\u4e0d\u544a\u8bc9\u59d0\u59d0\u6211\uff0c\u592a\u4e0d\u591f\u610f\u601d\u4e86\uff01\u600e\u4e48\u2026\u2026\u60f3\u91d1\u5c4b\u85cf\u201c\u5a07\u201d\u554a\uff01\n   <\/p>\n<p>\n    Nina\uff1a\u4e0d\u662f\u5566\uff0c\u4e5f\u662f\u6700\u8fd1\u521a\u6709\u4e8b\uff0c\u8fd8\u6ca1\u6765\u5f97\u53ca\u544a\u8bc9\u4f60\u5462\u3002\n   <\/p>\n<p>\n    Amy\uff1a\u90a3\u5feb\u8bf4\u8bf4\u5457\uff01\u90a3\u5c0f\u54e5\u770b\u7740\u5f88\u9ad8\u554a\uff01\n   <\/p>\n<p>\n    Nina\uff1a\u55ef\uff0c\u4ed61\u7c7385\u3002\n   <\/p>\n<p>\n    Amy\uff1a\u5389\u5bb3\u4e86\uff0c\u4f60155 \u4ed6185\uff0c\u8fd9\u5c31\u662f\u4f20\u8bf4\u4e2d\u7684\u6700\u840c\u8eab\u9ad8\u7ec4\u5408\u554a\uff01\n   <\/p>\n<p>\n    Nina\uff1a\u55ef\uff0c\u8d70\u5728\u5927\u8857\u4e0a\uff0c\u522b\u4eba\u90fd\u56de\u5934\u770b\u6211\u4eec\uff0c\u5f04\u7684\u6211\u633a\u4e0d\u597d\u4e86\u610f\u601d\u7684~\n   <\/p>\n<p>\n    Amy\uff1a\u4f60\u8fd9\u662f\u8eab\u5728\u798f\u4e2d\u4e0d\u77e5\u798f\u554a\uff01\u522b\u4eba\u5c31\u662f\u56e0\u4e3a\u60f3\u6c42\u4e5f\u6c42\u4e0d\u5230\u5462\uff01\n   <\/p>\n<p>\n    Nina\uff1a\u4e5f\u6709\u5f88\u6c14\u7684\u65f6\u5019\u5566\uff0c\u6709\u65f6\u751f\u6c14\u60f3\u6253\u4ed6\uff0c\u7ed3\u679c\u7c89\u62f3\u4e00\u51fa\u53bb\u5c31\u88ab\u4ed6\u7684\u5927\u624b\u5305\u4e86\u997a\u5b50\u3002\n   <\/p>\n<p>\n    Amy\uff1a\u54c8\u54c8\u54c8\u54c8\uff0c\u8fd8\u6709\u5462\uff01\n   <\/p>\n<p>\n    Nina\uff1a\u8fd8\u6709\u4e00\u4ef6\u5f88\u56e7\u7684\u4e8b\uff0c\u6211\u4e00\u62ac\u5934\u603b\u662f\u770b\u5230\u4ed6\u7684\u9f3b\u6bdb\uff0c\u4ed6\u4e00\u4f4e\u5934\u603b\u662f\u770b\u5230\u6211\u7684\u5934\u53d1\u5c51\uff01\n   <\/p>\n<p>\n    Amy\uff1a\u54c8\u54c8\u54c8\uff01\u7b11\u7684\u6211\u809a\u5b50\u75db\u4e86\u2026\u2026\u6240\u4ee5\u4f60\u4eec\u5728\u4e00\u8d77\uff0c\u4f60\u4e00\u5b9a\u8981\u5929\u5929\u6d17\u5934\uff0c\u4ed6\u4e00\u5b9a\u8981\u5929\u5929\u4fee\u9f3b\u6bdb\u54af~\n   <\/p>\n<p>\n    Nina\uff1a\u662f\u554a\uff01\u53ef\u9ebb\u70e6\u4e86~\n   <\/p>\n<p>\n    Amy\uff1a\u770b\u6765\u8fd8\u662f\u6211\u8fd9 160 \u7684\u8eab\u9ad8\u6700\u68d2\u4e86\uff01\u8863\u670d\u53ef\u4ee5\u968f\u4fbf\u6311\uff0c\u66f4\u91cd\u8981\u7684\u662f\u6211\u7537\u53cb 175\uff0c\u7a7f\u4e0a\u9ad8\u8ddf\u978b\uff0c\u6211\u5c31\u53ef\u4ee5\u633d\u7740\u4ed6\u7684\u624b\u80a9\u5e76\u80a9\u5730\u8d70~\n   <\/p>\n<p>\n    Nina\uff1a\u8fd9\u5c31\u662f\u6240\u8c13\u7684<br \/>\n    <strong><br \/>\n     \u8eab\u9ad8\u4e0d\u591f\u978b\u6765\u51d1<br \/>\n    <\/strong><br \/>\n    \u5417\uff1f\n   <\/p>\n<p>\n    Amy\uff1a\u4e0d\u7136\u600e\u4e48\u53eb\u4e07\u80fd\u7684\u9ad8\u8ddf\u978b\u5462\u2026\u2026\n   <\/p>\n<p>\n    Nina\uff1a\u597d\u7fa1\u6155\u554a\uff01\u5728\u6211\u8fd9\uff0c\u9ad8\u8ddf\u978b\u4e5f\u65e0\u80fd~\n   <\/p>\n<p>\n    Amy\uff1a&#8230; &#8230;\n   <\/p>\n<p>\n    \u6b63\u542c\u7684\u5174\u8d77\u65f6\uff0c\u5730\u94c1\u95e8\u5f00\u4e86\u3002Tony \u624d\u53cd\u5e94\u8fc7\u6765\uff0c\u5230\u7ad9\u4e86\uff0c\u8be5\u4e0b\u8f66\u4e86\u3002Tony \u8d76\u5fd9\u5f80\u8f66\u95e8\u65b9\u5411\u8d70\uff0c\u4e00\u4e0d\u5c0f\u5fc3\u989d\u5934\u78b0\u5230\u4e86\u628a\u624b\u4e0a\uff0c\u53ea\u597d\u4e00\u624b\u62a4\u7740\u5934\u5f80\u5916\u8dd1\uff0c\u4e24\u4e2a\u5c0f\u59d1\u5a18\u76f8\u89c6\u4e00\u7b11~\n   <\/p>\n<\/blockquote>\n<h4>\n   \u7528\u7a0b\u5e8f\u6765\u6a21\u62df\u751f\u6d3b<br \/>\n  <\/h4>\n<p>\n   \u8eab\u6750\u82d7\u6761\u3001\u957f\u50cf\u51fa\u4f17\u662f\u6bcf\u4e2a\u4eba\u68a6\u5bd0\u4ee5\u6c42\u7684\uff0c\u5c24\u5176\u662f\u5973\u5b69\u5b50\uff01\u4f46\u5f88\u591a\u4eba\u5374\u56e0\u4e3a\u5148\u5929\u7684\u539f\u56e0\u5e76\u4e0d\u80fd\u5982\u610f\uff0c\u8fd9\u65f6\u5c31\u9700\u8981\u901a\u8fc7\u670d\u88c5\u3001\u5316\u5986\u53bb\u5f25\u8865\u3002\u6240\u8c13\u7f8e\u5973\uff0c\u4e09\u5206\u9760\u957f\u76f8\u4e03\u5206\u9760\u6253\u626e\uff01\u6bd4\u5982\u8eab\u9ad8\u4e0d\u591f\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u7a7f\u9ad8\u8ddf\u978b\u6765\u5f25\u8865\uff1b\u5982\u679c\u672c\u8eab\u5c31\u6bd4\u8f83\u9ad8\uff0c\u90a3\u7a7f\u4e0d\u7a7f\u9ad8\u8ddf\u978b\u5c31\u6ca1\u90a3\u4e48\u91cd\u8981\u4e86\u3002\u8fd9\u91cc\u7684\u9ad8\u8ddf\u978b\u5c31\u8d77\u7740\u4e00\u4e2a\u9002\u914d\u7684\u4f5c\u7528\uff0c\u80fd\u8ba9\u4f60\u7684\u5f62\u8c61\u589e\u9ad8\u56db\u3001\u4e94\u5398\u7c73\uff0c\u4e0b\u9762\u6211\u4eec\u5c31\u7528\u4ee3\u7801\u6765\u6a21\u62df\u4e00\u4e0b\u9ad8\u8ddf\u978b\u5728\u751f\u6d3b\u4e2d\u7684\u573a\u666f\u5427\uff01\n  <\/p>\n<p>\n   \u6e90\u7801\u793a\u4f8b\uff1a\n  <\/p>\n<pre><code>class IHightPerson:    \"\u63a5\u53e3\u7c7b\uff0c\u63d0\u4f9b\u7a7a\u5b9e\u73b0\u7684\u65b9\u6cd5\uff0c\u7531\u5b50\u7c7b\u53bb\u5b9e\u73b0\"    def getName(self):        \"\u83b7\u53d6\u59d3\u540d\"        pass    def getHeight(self):        \"\u83b7\u53d6\u8eab\u9ad8\"        passclass HighPerson(IHightPerson):    \"\u4e2a\u9ad8\u7684\u4eba\"    def __init__(self, name):        self.__name = name    def getName(self):        return self.__name    def getHeight(self):        return 170class ShortPerson:    \"\u4e2a\u77ee\u7684\u4eba\"    def __init__(self, name):        self.__name = name    def getName(self):        return self.__name    def getRealHeight(self):        return 160    def getShoesHeight(self):        return 6class DecoratePerson(ShortPerson, IHightPerson):    \"\u6709\u9ad8\u8ddf\u978b\u642d\u914d\u7684\u4eba\"    def getHeight(self):        return super().getRealHeight() + super().getShoesHeight()<\/code><\/pre>\n<p>\n   \u6d4b\u8bd5\u4ee3\u7801\uff1a\n  <\/p>\n<pre><code>def canPlayReceptionist(person):    \"\"\"    \u662f\u5426\u53ef\u4ee5\u6210\u4e3a(\u9ad8\u7ea7\u9152\u5e97)\u63a5\u5f85\u5458    :param person: IHightPerson\u7684\u5bf9\u8c61    :return: \u662f\u5426\u7b26\u5408\u505a\u63a5\u5f85\u5458\u7684\u6761\u4ef6    \"\"\"    return person.getHeight() &gt;= 165;def testPerson():    lira = HighPerson(\"Lira\")    print(lira.getName() + \"\u8eab\u9ad8\" + str(lira.getHeight()) + \"\uff0c\u5b8c\u7f8e\u5982\u4f60\uff0c\u5929\u751f\u7684\u7f8e\u5973\uff01\" )    print(\"\u662f\u5426\u9002\u5408\u505a\u63a5\u5f85\u5458\uff1a\", \"\u7b26\u5408\" if canPlayReceptionist(lira) else \"\u4e0d\u7b26\u5408\")    print()    demi = DecoratePerson(\"Demi\");    print(demi.getName() + \"\u8eab\u9ad8\" + str(demi.getHeight()) + \"\u5728\u9ad8\u8ddf\u978b\u7684\u9002\u914d\u4e0b\uff0c\u4f60\u8eab\u9ad8\u4e0d\u8f93\u9ad8\u5706\u5706\uff0c\u6c14\u8d28\u4e0d\u8f93\u8303\u51b0\u51b0\uff01\")    print(\"\u662f\u5426\u9002\u5408\u505a\u63a5\u5f85\u5458\uff1a\", \"\u7b26\u5408\" if canPlayReceptionist(lira) else \"\u4e0d\u7b26\u5408\")<\/code><\/pre>\n<p>\n   \u8f93\u51fa\u7ed3\u679c\uff1a\n  <\/p>\n<pre><code>Lira\u8eab\u9ad8170\uff0c\u5b8c\u7f8e\u5982\u4f60\uff0c\u5929\u751f\u7684\u7f8e\u5973\uff01\u662f\u5426\u9002\u5408\u505a\u63a5\u5f85\u5458\uff1a \u7b26\u5408Demi\u8eab\u9ad8166\u5728\u9ad8\u8ddf\u978b\u7684\u9002\u914d\u4e0b\uff0c\u4f60\u8eab\u9ad8\u4e0d\u8f93\u9ad8\u5706\u5706\uff0c\u6c14\u8d28\u4e0d\u8f93\u8303\u51b0\u51b0\uff01\u662f\u5426\u9002\u5408\u505a\u63a5\u5f85\u5458\uff1a \u7b26\u5408<\/code><\/pre>\n<h4>\n   \u4ece\u5267\u60c5\u4e2d\u601d\u8003\u9002\u914d\u5668\u6a21\u5f0f<br \/>\n  <\/h4>\n<p>\n   \u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u9ad8\u8ddf\u978b\u8d77\u7740\u4e00\u4e2a\u9002\u914d\u7684\u4f5c\u7528\uff0c\u8ba9\u5176\u5f62\u8c61\u589e\u9ad8 5~7 \u5398\u7c73\u5b8c\u5168\u4e0d\u5728\u8bdd\u4e0b\uff0c\u800c\u4e14\u6548\u679c\u7acb\u7aff\u89c1\u5f71\uff01\u4f7f\u5f97\u4e00\u4e9b\u5973\u5b69\u539f\u672c\u4e0d\u7b26\u5408\u63a5\u5f85\u5458\u7684\u771f\u5b9e\u8eab\u9ad8\uff0c\u5728\u978b\u5b50\u7684\u5e2e\u52a9\u4e0b\u4e5f\u80fd\u7b26\u5408\u6761\u4ef6\u3002\u5982\u9ad8\u8ddf\u978b\u4e00\u6837\uff0c\u4f7f\u539f\u672c\u4e0d\u5339\u914d\u67d0\u79cd\u529f\u80fd\u7684\u5bf9\u8c61\u53d8\u5f97\u5339\u914d\u8fd9\u79cd\u529f\u80fd\uff0c\u8fd9\u5728\u7a0b\u5e8f\u4e2d\u53eb\u505a\u9002\u914d\u5668\u6a21\u5f0f\u3002\n  <\/p>\n<h5>\n   \u9002\u914d\u5668\u6a21\u5f0f<br \/>\n  <\/h5>\n<blockquote>\n<p>\n    Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn&#8217;t otherwise because of incompatible interfaces.\n   <\/p>\n<p>\n    \u5c06\u4e00\u4e2a\u7c7b\u7684\u63a5\u53e3\u53d8\u6210\u5ba2\u6237\u7aef\u6240\u671f\u671b\u7684\u53e6\u4e00\u79cd\u63a5\u53e3\uff0c\u4ece\u800c\u4f7f\u539f\u672c\u56e0\u63a5\u53e3\u4e0d\u5339\u914d\u800c\u65e0\u6cd5\u4e00\u8d77\u5de5\u4f5c\u7684\u4e24\u4e2a\u7c7b\u80fd\u591f\u5728\u4e00\u8d77\u5de5\u4f5c\u3002\n   <\/p>\n<\/blockquote>\n<p>\n   \u9002\u914d\u5668\u6a21\u5f0f\u7684\u4f5c\u7528\uff1a\n  <\/p>\n<ul>\n<li>\n    \u63a5\u53e3\u8f6c\u6362\uff0c\u5c06\u539f\u6709\u7684\u63a5\u53e3\uff08\u6216\u65b9\u6cd5\uff09\u8f6c\u6362\u6210\u53e6\u4e00\u79cd\u63a5\u53e3\uff1b\n   <\/li>\n<li>\n    \u7528\u65b0\u7684\u63a5\u53e3\u5305\u88c5\u4e00\u4e2a\u5df2\u6709\u7684\u7c7b\uff1b\n   <\/li>\n<li>\n    \u5339\u914d\u4e00\u4e2a\u8001\u7684\u7ec4\u4ef6\u5230\u4e00\u4e2a\u65b0\u7684\u63a5\u53e3\u3002\n   <\/li>\n<\/ul>\n<h5>\n   \u8bbe\u8ba1\u601d\u60f3<br \/>\n  <\/h5>\n<p>\n   \u9002\u914d\u5668\u6a21\u5f0f\u53c8\u53eb\u53d8\u538b\u5668\u6a21\u5f0f\uff0c\u4e5f\u53eb\u5305\u88c5\u6a21\u5f0f\uff08Wrapper\uff09\uff0c\u5b83\u7684\u6838\u5fc3\u601d\u60f3\u662f\u5c06\u4e00\u4e2a\u5bf9\u8c61\u7ecf\u8fc7\u5305\u88c5\u6216\u8f6c\u6362\u540e\u4f7f\u5b83\u7b26\u5408\u6307\u5b9a\u7684\u63a5\u53e3\uff0c\u4f7f\u5f97\u8c03\u7528\u65b9\u53ef\u4ee5\u50cf\u4f7f\u7528\u8fd9\u63a5\u53e3\u7684\u4e00\u822c\u5bf9\u8c61\u4e00\u6837\u4f7f\u7528\u5b83\u3002\u8fd9\u4e00\u601d\u60f3\uff0c\u5728\u6211\u4eec\u751f\u6d3b\u4e2d\u53ef\u8c13\u662f\u5904\u5904\u53ef\u89c1\uff0c\u6bd4\u5982\u53d8\u538b\u5668\u63d2\u5ea7\uff0c\u80fd\u8ba9\u4f60\u50cf\u4f7f\u7528\u56fd\u5185\u7535\u5668\u4e00\u6837\u4f7f\u7528\u7f8e\u6807\uff08110V\uff09\u7535\u5668\uff1b\u8fd8\u6709\u5c31\u662f\u5404\u79cd\u8f6c\u63a5\u5934\uff0c\u5982 MiniDP \u8f6c HDMI \u8f6c\u63a5\u5934\u3001HDMI \u8f6c VGA \u7ebf\u8f6c\u6362\u5668\u3001Micro USB \u8f6c Type-C \u8f6c\u63a5\u5934\u7b49\u3002\n  <\/p>\n<p>\n   \u4f60\u4eec\u77e5\u9053\u5417\uff1f\u201c\u8bbe\u8ba1\u6a21\u5f0f\u201d\u4e00\u8bcd\u6700\u521d\u662f\u6765\u6e90\u4e8e\u5efa\u7b51\u9886\u57df\uff0c\u800c\u4e2d\u56fd\u53e4\u5efa\u7b51\u662f\u4e16\u754c\u5efa\u7b51\u53f2\u7684\u4e00\u5927\u5947\u8ff9\uff08\u5982\u6700\u5177\u4ee3\u8868\u6027\u7684\u7d2b\u7981\u57ce\uff09\uff0c\u4e2d\u56fd\u53e4\u5efa\u7b51\u7684\u7075\u9b42\u662f\u4e00\u79cd\u53eb<br \/>\n   <strong><br \/>\n    \u69ab\u536f\u7ed3\u6784<br \/>\n   <\/strong><br \/>\n   \u7684\u5efa\u9020\u7406\u5ff5\u3002\n  <\/p>\n<blockquote>\n<p>\n    \u69ab\u536f\uff08s\u01d4n m\u01ceo\uff09\u662f\u4e24\u4e2a\u6728\u6784\u4ef6\u4e0a\u6240\u91c7\u7528\u7684\u4e00\u79cd\u51f9\u51f8\u7ed3\u5408\u7684\u8fde\u63a5\u65b9\u5f0f\u3002\u51f8\u51fa\u90e8\u5206\u53eb\u69ab\uff08\u6216\u69ab\u5934\uff09\uff1b\u51f9\u8fdb\u90e8\u5206\u53eb\u536f\uff08\u6216\u69ab\u773c\u3001\u69ab\u69fd\uff09\u3002\u5b83\u662f\u53e4\u4ee3\u4e2d\u56fd\u5efa\u7b51\u3001\u5bb6\u5177\u53ca\u5176\u4ed6\u6728\u5236\u5668\u68b0\u7684\u4e3b\u8981\u7ed3\u6784\u65b9\u5f0f\u3002\n   <\/p>\n<\/blockquote>\n<p>\n   \u69ab\u536f\u7ed3\u6784\u7684\u7ecf\u5178\u6a21\u578b\u5982\u4e0b\u56fe\uff1a\n  <\/p>\n<\/p>\n<p>\n   \u69ab\u536f\u662f\u85cf\u5728\u6728\u5934\u91cc\u7684\u7075\u9b42\uff01\u800c\u968f\u7740\u65f6\u4ee3\u7684\u53d8\u5316\uff0c\u5176\u7ed3\u6784\u4e5f\u53d1\u751f\u7740\u4e00\u4e9b\u53d8\u5316\uff0c\u73b0\u5728\u5f88\u591a\u5efa\u6750\u751f\u4ea7\u5546\u4e5f\u5728\u53d1\u660e\u548c\u751f\u4ea7\u65b0\u578b\u7684\u5177\u6709\u69ab\u536f\u7ed3\u6784\u7684\u6728\u677f\u3002\u5047\u8bbe\u6728\u677f\u751f\u4ea7\u5546\u6709\u4e0b\u9762\u4e24\u5757\u6728\u677f\uff0c\u6728\u677f A \u662f\u69ab\uff0c\u6728\u677f B \u662f\u536f\uff0cA\u3001B \u4e24\u5757\u6728\u677f\u5c31\u5b8c\u5168\u543b\u5408\u3002\u4ed6\u4eec\u4e4b\u95f4\u7684\u69ab\u536f\u63a5\u53e3\u662f\u4e00\u79cd T \u5b57\u5f62\u7684\u63a5\u53e3\u3002\n  <\/p>\n<\/p>\n<p>\n   \u540e\u6765\uff0c\u968f\u7740\u4e1a\u52a1\u7684\u62d3\u5c55\uff0c\u6728\u677f\u5382\u5546\u589e\u52a0\u4e86\u4e00\u79cd\u65b0\u6728\u677f C\u3002\u4f46 C \u662f L \u5f62\u7684\u63a5\u53e3\uff0c\u4e0d\u80fd\u4e0e\u6728\u677f A \u5bf9\u63a5\u3002\u4e3a\u4e86\u8ba9\u6728\u677f C \u80fd\u4e0e\u6728\u677f A \u8fdb\u884c\u5bf9\u63a5\uff0c\u5c31\u9700\u8981\u589e\u52a0\u4e00\u4e2a\u8854\u63a5\u677f D \u8fdb\u884c\u9002\u914d\uff0c\u800c\u8fd9\u4e2a D \u5c31\u76f8\u5f53\u4e8e\u9002\u914d\u5668\uff0c\u5982\u4e0b\u56fe\uff1a\n  <\/p>\n<\/p>\n<p>\n   \u9002\u914d\u5668\u6a21\u5f0f\u901a\u5e38\u7528\u4e8e\u5bf9\u5df2\u6709\u7684\u7cfb\u7edf\u62d3\u5c55\u65b0\u529f\u80fd\u65f6\uff0c\u5c24\u5176\u9002\u7528\u4e8e\u5728\u8bbe\u8ba1\u826f\u597d\u7684\u7cfb\u7edf\u6846\u67b6\u4e0b\u63a5\u5165\u7b2c\u4e09\u65b9\u7684\u63a5\u53e3\u6216\u7b2c\u4e09\u65b9\u7684 SDK \u65f6\u3002\u5728\u7cfb\u7edf\u7684\u6700\u521d\u8bbe\u8ba1\u9636\u6bb5\uff0c\u6700\u597d\u4e0d\u8981\u628a\u9002\u914d\u5668\u6a21\u5f0f\u8003\u8651\u8fdb\u53bb\uff0c\u9664\u975e\u4e00\u4e9b\u7279\u6b8a\u7684\u573a\u666f\uff08\u5982\u7cfb\u7edf\u672c\u8eab\u5c31\u662f\u8981\u53bb\u5bf9\u63a5\u548c\u9002\u914d\u591a\u79cd\u7c7b\u578b\u7684\u786c\u4ef6\u63a5\u53e3\uff09\u3002\n  <\/p>\n<h4>\n   \u9002\u914d\u5668\u6a21\u5f0f\u7684\u6a21\u578b\u62bd\u8c61<br \/>\n  <\/h4>\n<h5>\n   \u7c7b\u56fe<br \/>\n  <\/h5>\n<p>\n   \u9002\u914d\u5668\u6a21\u5f0f\u7684\u7c7b\u56fe\u5982\u4e0b\uff1a\n  <\/p>\n<\/p>\n<p>\n   Target \u662f\u4e00\u4e2a\u63a5\u53e3\u7c7b\uff0c\u662f\u63d0\u4f9b\u7ed9\u7528\u6237\u8c03\u7528\u7684\u63a5\u53e3\u62bd\u8c61\uff0c\u5982\u4e0a\u9762\u793a\u4f8b\u4e2d\u7684 IHightPerson\u3002Adaptee \u662f\u4f60\u8981\u8fdb\u884c\u9002\u914d\u7684\u5bf9\u8c61\u7c7b\uff0c\u5982\u4e0a\u9762\u7684 ShortPerson\u3002Adapter \u662f\u4e00\u4e2a\u9002\u914d\u5668\uff0c\u662f\u5bf9 Adaptee \u7684\u9002\u914d\uff0c\u5b83\u5c06 Adaptee \u7684\u5bf9\u8c61\u8f6c\u6362\uff08\u6216\u8bf4\u5305\u88c5\uff09\u6210\u7b26\u5408 Target \u63a5\u53e3\u7684\u5bf9\u8c61\uff1b\u5982\u4e0a\u9762\u7684 DecoratePerson\uff0c\u5c06 ShortPerson \u7684 getRealHeight \u548c getShoesHeight \u65b9\u6cd5\u5305\u88c5\u6210 IHightPerson \u7684 getHeight \u63a5\u53e3\u3002\n  <\/p>\n<h4>\n   \u6a21\u578b\u8bf4\u660e<br \/>\n  <\/h4>\n<h5>\n   \u8bbe\u8ba1\u8981\u70b9<br \/>\n  <\/h5>\n<p>\n   \u9002\u914d\u5668\u6a21\u5f0f\u4e2d\u4e3b\u8981\u4e09\u4e2a\u89d2\u8272\uff0c\u5728\u8bbe\u8ba1\u9002\u914d\u5668\u6a21\u5f0f\u65f6\u8981\u627e\u5230\u5e76\u533a\u5206\u8fd9\u4e9b\u89d2\u8272\uff1a\n  <\/p>\n<ul>\n<li>\n    <strong><br \/>\n     \u76ee\u6807\uff08Target\uff09\uff1a<br \/>\n    <\/strong><br \/>\n    \u5373\u4f60\u671f\u671b\u7684\u76ee\u6807\u63a5\u53e3\uff0c\u8981\u8f6c\u6362\u6210\u7684\u63a5\u53e3\u3002\n   <\/li>\n<li>\n    <strong><br \/>\n     \u6e90\u5bf9\u8c61\uff08Adaptee\uff09\uff1a<br \/>\n    <\/strong><br \/>\n    \u5373\u8981\u88ab\u8f6c\u6362\u7684\u89d2\u8272\uff0c\u8981\u628a\u8c01\u8f6c\u6362\u6210\u76ee\u6807\u89d2\u8272\u3002\n   <\/li>\n<li>\n    <strong><br \/>\n     \u9002\u914d\u5668\uff08Adapter\uff09\uff1a<br \/>\n    <\/strong><br \/>\n    \u9002\u914d\u5668\u6a21\u5f0f\u7684\u6838\u5fc3\u89d2\u8272\uff0c\u8d1f\u8d23\u628a\u6e90\u5bf9\u8c61\u8f6c\u6362\u548c\u5305\u88c5\u6210\u76ee\u6807\u5bf9\u8c61\u3002\n   <\/li>\n<\/ul>\n<h5>\n   \u4f18\u7f3a\u70b9<br \/>\n  <\/h5>\n<h6>\n   \u9002\u914d\u5668\u6a21\u5f0f\u7684\u4f18\u70b9<br \/>\n  <\/h6>\n<ul>\n<li>\n    \u53ef\u4ee5\u8ba9\u4e24\u4e2a\u6ca1\u6709\u5173\u8054\u7684\u7c7b\u4e00\u8d77\u8fd0\u884c\uff0c\u8d77\u7740\u4e2d\u95f4\u8f6c\u6362\u7684\u4f5c\u7528\u3002\n   <\/li>\n<li>\n    \u63d0\u9ad8\u4e86\u7c7b\u7684\u590d\u7528\u3002\n   <\/li>\n<li>\n    \u7075\u6d3b\u6027\u597d\uff0c\u4e0d\u4f1a\u7834\u574f\u539f\u6709\u7684\u7cfb\u7edf\u3002\n   <\/li>\n<\/ul>\n<h6>\n   \u9002\u914d\u5668\u6a21\u5f0f\u7684\u7f3a\u70b9<br \/>\n  <\/h6>\n<ul>\n<li>\n    \u5982\u679c\u539f\u6709\u7cfb\u7edf\u6ca1\u6709\u8bbe\u8ba1\u597d\uff08\u5982 Target \u4e0d\u662f\u62bd\u8c61\u7c7b\u6216\u63a5\u53e3\uff0c\u800c\u4e00\u4e2a\u5b9e\u4f53\u7c7b\uff09\uff0c\u9002\u914d\u5668\u6a21\u5f0f\u5c06\u5f88\u96be\u5b9e\u73b0\u3002\n   <\/li>\n<li>\n    \u8fc7\u591a\u5730\u4f7f\u7528\u9002\u914d\u5668\uff0c\u5bb9\u6613\u4f7f\u4ee3\u7801\u7ed3\u6784\u6df7\u4e71\uff0c\u5982\u660e\u660e\u770b\u5230\u8c03\u7528\u7684\u662f A \u63a5\u53e3\uff0c\u5185\u90e8\u8c03\u7528\u7684\u5374\u662f B \u63a5\u53e3\u7684\u5b9e\u73b0\u3002\n   <\/li>\n<\/ul>\n<h4>\n   \u5b9e\u6218\u5e94\u7528<br \/>\n  <\/h4>\n<p>\n   \u6709\u4e00\u4e2a\u7535\u5b50\u4e66\u9605\u8bfb\u5668\u7684\u9879\u76ee\uff08Reader\uff09\uff0c\u7814\u53d1\u4e4b\u521d\uff0c\u4ea7\u54c1\u7ecf\u7406\u7ecf\u8fc7\u5404\u65b9\u8ba8\u8bba\uff0c\u6700\u540e\u544a\u8bc9\u6211\u4eec\u53ea\u652f\u6301 TXT \u548c Epub \u683c\u5f0f\u7684\u7535\u5b50\u4e66\u3002\u7136\u540e\u7ecf\u8fc7\u4ed4\u7ec6\u601d\u8003\u3001\u7cbe\u5fc3\u8bbe\u8ba1\uff0c\u91c7\u7528\u4e86\u5982\u56fe1\u7684\u4ee3\u7801\u67b6\u6784\u3002\u5728\u8fd9\u4e2a\u7c7b\u56fe\u4e2d\uff0c\u6709\u4e00\u4e2a\u9605\u8bfb\u5668\u7684\u6838\u5fc3\u7c7b Reader\uff0c\u4e00\u4e2a TXT \u6587\u6863\u7684\u5173\u952e\u7c7b TxtBook\uff08\u8d1f\u8d23 TXT \u683c\u5f0f\u6587\u4ef6\u7684\u89e3\u6790\uff09\uff0c\u548c\u4e00\u4e2a Epub \u6587\u6863\u7684\u5173\u952e\u7c7b EpubBook\uff08\u8d1f\u8d23 Epub \u683c\u5f0f\u6587\u4ef6\u7684\u89e3\u6790\uff09\u3002\n  <\/p>\n<\/p>\n<p>\n   \u56fe1\uff1a\u9605\u8bfb\u5668\u7c7b\u56fe\n  <\/p>\n<p>\n   \u4ea7\u54c1\u4e0a\u7ebf\u534a\u5e74\u540e\uff0c\u5e02\u573a\u54cd\u5e94\u826f\u597d\uff0c\u4e1a\u52a1\u90e8\u95e8\u53cd\u6620\uff1a\u6709\u5f88\u591a\u529e\u516c\u4eba\u5458\u4e5f\u5728\u7528\u6211\u4eec\u7684\u9605\u8bfb\u5668\uff0c\u4ed6\u4eec\u5e0c\u671b\u8fd9\u4e2a\u9605\u8bfb\u5668\u80fd\u540c\u65f6\u652f\u6301 PDF \u683c\u5f0f\uff0c\u8fd9\u6837\u5c31\u4e0d\u7528\u5728\u591a\u4e2a\u9605\u8bfb\u5668\u795e\u4e4b\u95f4\u6765\u56de\u5207\u6362\u4e86\uff0c\u6b64\u65f6\u7a0b\u5e8f\u5c31\u9700\u8981\u589e\u52a0\u5bf9 PDF \u683c\u5f0f\u7684\u652f\u6301\uff0c\u800c PDF \u5e76\u4e0d\u662f\u6838\u5fc3\u4e1a\u52a1\uff0c\u6211\u4eec\u4e0d\u4f1a\u5355\u72ec\u4e3a\u5176\u5f00\u53d1\u4e00\u5957 PDF \u89e3\u6790\u5185\u6838\uff0c\u800c\u4f1a\u4f7f\u7528\u4e00\u4e9b\u5f00\u6e90\u7684 PDF \u5e93\uff08\u6211\u4eec\u79f0\u5b83\u4e3a\u7b2c\u4e09\u65b9\u5e93\uff09\uff0c\u5982 MuPDF\u3001TCPDF \u7b49\u3002\u800c\u5f00\u6e90\u5e93\u7684\u63a5\u53e3\u548c\u6211\u4eec\u7684\u63a5\u53e3\u5e76\u4e0d\u76f8\u540c\uff08\u5982\u56fe2\uff09\uff0c\u8fd4\u56de\u7684\u5185\u5bb9\u4e5f\u4e0d\u662f\u6211\u4eec\u76f4\u63a5\u9700\u8981\u7684\uff0c\u9700\u8981\u7ecf\u8fc7\u4e00\u4e9b\u8f6c\u6362\u624d\u80fd\u7b26\u5408\u6211\u4eec\u7684\u8981\u6c42\u3002\n  <\/p>\n<\/p>\n<p>\n   \u56fe2\uff1a\u7b2c\u4e09\u65b9 PDF \u89e3\u6790\u5e93\u7684\u7c7b\u56fe\n  <\/p>\n<p>\n   \u8fd9\u65f6\uff0c\u6211\u4eec\u5c31\u9700\u8981\u5bf9 PDF \u7684\u89e3\u6790\u5e93 MuPDF \u8fdb\u884c\u9002\u914d\u3002\u7ecf\u8fc7\u4e0a\u9762\u7684\u5b66\u4e60\uff0c\u4f60\u4e00\u5b9a\u77e5\u9053\u8fd9\u65f6\u8be5\u7528\u9002\u914d\u5668\u6a21\u5f0f\u4e86\uff0c\u4e8e\u662f\u6709\u4e86\u5982\u4e0b\u56fe3\u7684\u7c7b\u56fe\u7ed3\u6784\u3002\n  <\/p>\n<\/p>\n<p>\n   \u56fe3\uff1a\u517c\u5bb9 PDF \u7684\u7c7b\u56fe\u7ed3\u6784\n  <\/p>\n<p>\n   <strong><br \/>\n    \u4ee3\u7801\u5b9e\u73b0\u5982\u4e0b\uff1a<br \/>\n   <\/strong>\n  <\/p>\n<pre><code>class Page:    \"\u7535\u5b50\u4e66\u4e00\u9875\u7684\u5185\u5bb9\"    def __init__(self, pageNum):        self.__pageNum = pageNum    def getContent(self):        return \"\u7b2c \" + str(self.__pageNum) + \" \u9875\u7684\u5185\u5bb9...\"class Catalogue:    \"\u76ee\u5f55\u7ed3\u6784\"    def __init__(self, title):        self.__title = title        self.__chapters = []        self.setChapter(\"\u7b2c\u4e00\u7ae0\")        self.setChapter(\"\u7b2c\u4e8c\u7ae0\")    def setChapter(self, title):        self.__chapters.append(title)    def showInfo(self):        print(\"\u6807\u9898\uff1a\" + self.__title)        for chapter in self.__chapters:            print(chapter)class IBook:    \"\u7535\u5b50\u4e66\u6587\u6863\u7684\u63a5\u53e3\u7c7b\"    def parseFile(self, filePath):        pass    def getCatalogue(self):        pass    def getPageCount(self):        pass    def getPage(self, pageNum):        passclass TxtBook(IBook):    \"TXT\u89e3\u6790\u7c7b\"    def parseFile(self, filePath):        # \u6a21\u62df\u6587\u6863\u7684\u89e3\u6790        print(filePath + \" \u6587\u4ef6\u89e3\u6790\u6210\u529f\")        self.__pageCount = 500        return True    def getCatalogue(self):        return Catalogue(\"TXT\u7535\u5b50\u4e66\")    def getPageCount(self):        return self.__pageCount    def getPage(self, pageNum):        return Page(pageNum)class EpubBook(IBook):    \"TXT\u89e3\u6790\u7c7b\"    def parseFile(self, filePath):        # \u6a21\u62df\u6587\u6863\u7684\u89e3\u6790        print(filePath + \" \u6587\u4ef6\u89e3\u6790\u6210\u529f\")        self.__pageCount = 800        return True    def getCatalogue(self):        return Catalogue(\"Epub\u7535\u5b50\u4e66\")    def getPageCount(self):        return self.__pageCount    def getPage(self, pageNum):        return Page(pageNum)class Outline:    \"\u7b2c\u4e09\u65b9PDF\u89e3\u6790\u5e93\u7684\u76ee\u5f55\u7c7b\"    passclass PdfPage:    \"PDF\u9875\"    def __init__(self, pageNum):        self.__pageNum = pageNum    def getPageNum(self):        return self.__pageNumclass ThirdPdf:    \"\u7b2c\u4e09\u65b9PDF\u89e3\u6790\u5e93\"    def __init__(self):        self.__pageSize = 0    def open(self, filePath):        print(\"\u7b2c\u4e09\u65b9\u89e3\u6790PDF\u6587\u4ef6\uff1a\" + filePath)        self.__pageSize = 1000        return True    def getOutline(self):        return Outline()    def pageSize(self):        return self.__pageSize    def page(self, index):        return PdfPage(index)class PdfAdapterBook(ThirdPdf, IBook):    \"TXT\u89e3\u6790\u7c7b\"    def parseFile(self, filePath):        # \u6a21\u62df\u6587\u6863\u7684\u89e3\u6790        rtn = super().open(filePath)        if(rtn):            print(filePath + \"\u6587\u4ef6\u89e3\u6790\u6210\u529f\")        return rtn    def getCatalogue(self):        outline = super().getOutline()        print(\"\u5c06Outline\u7ed3\u6784\u7684\u76ee\u5f55\u8f6c\u6362\u6210Catalogue\u7ed3\u6784\u7684\u76ee\u5f55\")        return Catalogue(\"PDF\u7535\u5b50\u4e66\")    def getPageCount(self):        return super().pageSize()    def getPage(self, pageNum):        page = self.page(pageNum)        print(\"\u5c06PdfPage\u7684\u9762\u5bf9\u8c61\u8f6c\u6362\u6210Page\u7684\u5bf9\u8c61\")        return Page(page.getPageNum())# \u5bfc\u5165os\u5e93import osclass Reader:    \"\u9605\u8bfb\u5668\"    def __init__(self, name):        self.__name = name        self.__filePath = \"\"        self.__curBook = None        self.__curPageNum = -1    def __initBook(self, filePath):        self.__filePath = filePath        extName = os.path.splitext(filePath)[1]        if(extName.lower() == \".epub\"):            self.__curBook = EpubBook()        elif(extName.lower() == \".txt\"):            self.__curBook = TxtBook()        elif(extName.lower() == \".pdf\"):            self.__curBook = PdfAdapterBook()        else:            self.__curBook = None    def openFile(self, filePath):        self.__initBook(filePath)        if(self.__curBook is not None):            rtn = self.__curBook.parseFile(filePath)            if(rtn):                self.__curPageNum = 1            return rtn        return False    def closeFile(self):        print(\"\u5173\u95ed \" + self.__filePath + \" \u6587\u4ef6\")        return True    def showCatalogue(self):        catalogue = self.__curBook.getCatalogue()        catalogue.showInfo()    def prePage(self):        return self.gotoPage(self.__curPageNum - 1)    def nextPage(self):        return self.gotoPage(self.__curPageNum + 1)    def gotoPage(self, pageNum):        if(pageNum &lt; 1 or pageNum &gt; self.__curBook.getPageCount()):            return None        self.__curPageNum = pageNum        print(\"\u663e\u793a\u7b2c\" + str(self.__curPageNum) + \"\u9875\")        page = self.__curBook.getPage(self.__curPageNum)        page.getContent()        return page<\/code><\/pre>\n<p>\n   \u6d4b\u8bd5\u4ee3\u7801\uff1a\n  <\/p>\n<pre><code>def testReader():    reader = Reader(\"\u9605\u8bfb\u5668\")    if(not reader.openFile(\"\u5e73\u51e1\u7684\u4e16\u754c.txt\")):        return    reader.showCatalogue()    reader.gotoPage(1)    reader.nextPage()    reader.closeFile()    print()    if (not reader.openFile(\"\u5e73\u51e1\u7684\u4e16\u754c.epub\")):        return    reader.showCatalogue()    reader.gotoPage(5)    reader.nextPage()    reader.closeFile()    print()    if (not reader.openFile(\"\u5e73\u51e1\u7684\u4e16\u754c.pdf\")):        return    reader.showCatalogue()    reader.gotoPage(10)    reader.nextPage()    reader.closeFile()<\/code><\/pre>\n<p>\n   <strong><br \/>\n    \u8f93\u51fa\u7ed3\u679c\uff1a<br \/>\n   <\/strong>\n  <\/p>\n<pre><code>\u5e73\u51e1\u7684\u4e16\u754c.txt \u6587\u4ef6\u89e3\u6790\u6210\u529f\u6807\u9898\uff1aTXT\u7535\u5b50\u4e66\u7b2c\u4e00\u7ae0\u7b2c\u4e8c\u7ae0\u663e\u793a\u7b2c1\u9875\u663e\u793a\u7b2c2\u9875\u5173\u95ed \u5e73\u51e1\u7684\u4e16\u754c.txt \u6587\u4ef6\u5e73\u51e1\u7684\u4e16\u754c.epub \u6587\u4ef6\u89e3\u6790\u6210\u529f\u6807\u9898\uff1aEpub\u7535\u5b50\u4e66\u7b2c\u4e00\u7ae0\u7b2c\u4e8c\u7ae0\u663e\u793a\u7b2c5\u9875\u663e\u793a\u7b2c6\u9875\u5173\u95ed \u5e73\u51e1\u7684\u4e16\u754c.epub \u6587\u4ef6\u7b2c\u4e09\u65b9\u89e3\u6790PDF\u6587\u4ef6\uff1a\u5e73\u51e1\u7684\u4e16\u754c.pdf\u5e73\u51e1\u7684\u4e16\u754c.pdf\u6587\u4ef6\u89e3\u6790\u6210\u529f\u5c06Outline\u7ed3\u6784\u7684\u76ee\u5f55\u8f6c\u6362\u6210Catalogue\u7ed3\u6784\u7684\u76ee\u5f55\u6807\u9898\uff1aPDF\u7535\u5b50\u4e66\u7b2c\u4e00\u7ae0\u7b2c\u4e8c\u7ae0\u663e\u793a\u7b2c10\u9875\u5c06PdfPage\u7684\u9762\u5bf9\u8c61\u8f6c\u6362\u6210Page\u7684\u5bf9\u8c61\u663e\u793a\u7b2c11\u9875\u5c06PdfPage\u7684\u9762\u5bf9\u8c61\u8f6c\u6362\u6210Page\u7684\u5bf9\u8c61\u5173\u95ed \u5e73\u51e1\u7684\u4e16\u754c.pdf \u6587\u4ef6<\/code><\/pre>\n<h4>\n   \u5e94\u7528\u573a\u666f<br \/>\n  <\/h4>\n<ul>\n<li>\n    \u7cfb\u7edf\u9700\u8981\u4f7f\u7528\u73b0\u6709\u7684\u7c7b\uff0c\u800c\u8fd9\u4e9b\u7c7b\u7684\u63a5\u53e3\u4e0d\u7b26\u5408\u73b0\u6709\u7cfb\u7edf\u7684\u8981\u6c42\u3002\n   <\/li>\n<li>\n    \u5bf9\u5df2\u6709\u7684\u7cfb\u7edf\u62d3\u5c55\u65b0\u529f\u80fd\u65f6\uff0c\u5c24\u5176\u9002\u7528\u4e8e\u5728\u8bbe\u8ba1\u826f\u597d\u7684\u7cfb\u7edf\u6846\u67b6\u4e0b\u589e\u52a0\u63a5\u5165\u7b2c\u4e09\u65b9\u7684\u63a5\u53e3\u6216\u7b2c\u4e09\u65b9\u7684 SDK \u65f6\u3002\n   <\/li>\n<\/ul>\n<blockquote>\n<p>\n    <a href=\"https:\/\/gitbook.cn\/m\/mazi\/comp\/column?columnId=5b26040ac81ac568fcf64ea3&amp;utm_source=lwfsd001\" rel=\"nofollow\"><br \/>\n     \u70b9\u51fb\u4e86\u89e3\u66f4\u591a\u300a\u767d\u8bdd\u8bbe\u8ba1\u6a21\u5f0f 28 \u8bb2\u300b<br \/>\n    <\/a>\n   <\/p>\n<\/blockquote>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c03\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u72b6\u6001\u6a21\u5f0f\u2014\u2014\u4eba\u4e0e\u6c34\u7684\u4e09\u6001<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c04\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u5355\u4f8b\u6a21\u5f0f\u2014\u2014\u4f60\u662f\u6211\u751f\u547d\u7684\u552f\u4e00<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c05\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u804c\u8d23\u6a21\u5f0f\u2014\u2014\u6211\u7684\u5047\u6761\u53bb\u54ea\u4e86<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c06\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u4e2d\u4ecb\u6a21\u5f0f\u2014\u2014\u627e\u623f\u5b50\u95ee\u4e2d\u4ecb<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c07\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u4ee3\u7406\u6a21\u5f0f\u2014\u2014\u5e2e\u6211\u62ff\u4e00\u4e0b\u5feb\u9012<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c08\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u88c5\u9970\u6a21\u5f0f\u2014\u2014\u4f60\u60f3\u600e\u4e48\u7a7f\u5c31\u600e\u4e48\u7a7f<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c09\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u5de5\u5382\u6a21\u5f0f\u2014\u2014\u4f60\u8981\u62ff\u94c1\u8fd8\u662f\u6469\u5361<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c10\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u8fed\u4ee3\u6a21\u5f0f\u2014\u2014\u4e0b\u4e00\u4e2a\u5c31\u662f\u4f60\u4e86<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c11\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u7ec4\u5408\u6a21\u5f0f\u2014\u2014\u81ea\u5df1\u7ec4\u88c5\u7535\u8111<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c12\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u6784\u5efa\u6a21\u5f0f\u2014\u2014\u60f3\u8981\u8f66\u8fd8\u662f\u5e84\u56ed<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c13\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u514b\u9686\u6a21\u5f0f\u2014\u2014\u7ed9\u4f60\u4e00\u4e2a\u5206\u8eab\u672f<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c14\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u7b56\u7565\u6a21\u5f0f\u2014\u2014\u600e\u4e48\u6765\u4e0d\u91cd\u8981\uff0c\u4eba\u5230\u5c31\u884c<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c15\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u547d\u4ee4\u6a21\u5f0f\u2014\u2014\u5927\u95f8\u87f9\uff0c\u8d70\u8d77<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c16\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u5907\u5fd8\u6a21\u5f0f\u2014\u2014\u597d\u8bb0\u6027\u4e0d\u5982\u70c2\u7b14\u5934<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c17\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u4eab\u5143\u6a21\u5f0f\u2014\u2014\u989c\u6599\u5f88\u8d35\u5fc5\u987b\u5145\u5206\u5229\u7528<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c18\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u5916\u89c2\u6a21\u5f0f\u2014\u2014\u5b66\u59b9\u522b\u614c\uff0c\u5b66\u957f\u5e2e\u4f60<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c19\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u8bbf\u95ee\u6a21\u5f0f\u2014\u2014\u4e00\u5343\u4e2a\u8bfb\u8005\u4e00\u5343\u4e2a\u54c8\u59c6\u96f7\u7279<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c20\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u8bbe\u8ba1\u6a21\u5f0f\u2014\u2014\u4e0e\u7ecf\u5178\u8bbe\u8ba1\u6a21\u5f0f\u7684\u4e0d\u89e3\u6e0a\u6e90<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c21\u8bfe\uff1a\u751f\u6d3b\u4e2d\u7684\u8bbe\u8ba1\u6a21\u5f0f\u2014\u2014\u90a3\u4e9b\u672a\u5b8c\u5f85\u7eed\u7684\u8bbe\u8ba1\u6a21\u5f0f<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c22\u8bfe\uff1a\u6df1\u5165\u89e3\u8bfb\u8fc7\u6ee4\u5668\u6a21\u5f0f\u2014\u2014\u5236\u4f5c\u4e00\u676f\u9c9c\u7eaf\u7ec6\u817b\u7684\u8c46\u6d46<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c23\u8bfe\uff1a\u6df1\u5165\u89e3\u8bfb\u5bf9\u8c61\u6c60\u6280\u672f\u2014\u2014\u5171\u4eab\u8ba9\u751f\u6d3b\u66f4\u4fbf\u6377<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c24\u8bfe\uff1a\u6df1\u5165\u89e3\u8bfb\u56de\u8c03\u673a\u5236\u2014\u2014\u628a\u4f60\u6280\u80fd\u4eae\u51fa\u6765<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c25\u8bfe\uff1a\u8c08\u8c08\u6211\u5bf9\u8bbe\u8ba1\u6a21\u5f0f\u7684\u7406\u89e3<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c26\u8bfe\uff1a\u8c08\u8c08\u6211\u5bf9\u8bbe\u8ba1\u539f\u5219\u7684\u601d\u8003<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u7b2c27\u8bfe\uff1a\u8c08\u8c08\u6211\u5bf9\u9879\u76ee\u91cd\u6784\u7684\u770b\u6cd5<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n   <\/a><br \/>\n  <\/h6>\n<h6>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    <strong><br \/>\n     \u9644\u5f55\uff1aPython \u4e2d Metaclass \u7684\u539f\u7406<br \/>\n    <\/strong><br \/>\n   <\/a><br \/>\n  <\/h6>\n<p>  <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n  <\/a><\/p>\n<p>\n   \u9605\u8bfb\u5168\u6587:<br \/>\n   <a href=\"http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3?utm_source=csdn_blog\" rel=\"nofollow\"><br \/>\n    http:\/\/gitbook.cn\/gitchat\/column\/5b26040ac81ac568fcf64ea3<br \/>\n   <\/a>\n  <\/p>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8bfe\u7a0b\u4ecb\u7ecd \u8bbe\u8ba1\u6a21\u5f0f\uff08Design Pattern\uff09\u662f\u4e00\u5957\u88ab\u53cd\u590d\u4f7f\u7528\u3001\u591a\u6570\u4eba\u77e5\u6653\u7684\u3001\u65e0\u6570\u5de5\u7a0b\u5e08\u5b9e\u8df5\u7684\u4ee3\u7801\u8bbe\u8ba1\u7ecf\u9a8c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-841","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-10"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09 - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51<\/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.wunen.com\/index.php\/2025\/04\/18\/\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08python\uff09\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09 - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"og:description\" content=\"\u8bfe\u7a0b\u4ecb\u7ecd \u8bbe\u8ba1\u6a21\u5f0f\uff08Design Pattern\uff09\u662f\u4e00\u5957\u88ab\u53cd\u590d\u4f7f\u7528\u3001\u591a\u6570\u4eba\u77e5\u6653\u7684\u3001\u65e0\u6570\u5de5\u7a0b\u5e08\u5b9e\u8df5\u7684\u4ee3\u7801\u8bbe\u8ba1\u7ecf\u9a8c [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08python\uff09\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-17T16:00:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"260\" \/>\n\t<meta property=\"og:image:height\" content=\"180\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin@wunen\" \/>\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@wunen\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/\"},\"author\":{\"name\":\"admin@wunen\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\"},\"headline\":\"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09\",\"datePublished\":\"2025-04-17T16:00:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/\"},\"wordCount\":402,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/www.wunen.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"articleSection\":[\"\u4fbf\u6377\u751f\u6d3b\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/\",\"url\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/\",\"name\":\"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09 - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"isPartOf\":{\"@id\":\"http:\/\/www.wunen.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"datePublished\":\"2025-04-17T16:00:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"width\":260,\"height\":180},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.wunen.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.wunen.com\/#website\",\"url\":\"http:\/\/www.wunen.com\/\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"description\":\"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9\",\"publisher\":{\"@id\":\"http:\/\/www.wunen.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.wunen.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/www.wunen.com\/#organization\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"url\":\"http:\/\/www.wunen.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"width\":1024,\"height\":1024,\"caption\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\",\"name\":\"admin@wunen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"caption\":\"admin@wunen\"},\"sameAs\":[\"http:\/\/www.wunen.com\"],\"url\":\"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09 - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","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.wunen.com\/index.php\/2025\/04\/18\/\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08python\uff09\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09 - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","og_description":"\u8bfe\u7a0b\u4ecb\u7ecd \u8bbe\u8ba1\u6a21\u5f0f\uff08Design Pattern\uff09\u662f\u4e00\u5957\u88ab\u53cd\u590d\u4f7f\u7528\u3001\u591a\u6570\u4eba\u77e5\u6653\u7684\u3001\u65e0\u6570\u5de5\u7a0b\u5e08\u5b9e\u8df5\u7684\u4ee3\u7801\u8bbe\u8ba1\u7ecf\u9a8c [&hellip;]","og_url":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08python\uff09\/","og_site_name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","article_published_time":"2025-04-17T16:00:10+00:00","og_image":[{"width":260,"height":180,"url":"https:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","type":"image\/jpeg"}],"author":"admin@wunen","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin@wunen","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#article","isPartOf":{"@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/"},"author":{"name":"admin@wunen","@id":"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8"},"headline":"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09","datePublished":"2025-04-17T16:00:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/"},"wordCount":402,"commentCount":0,"publisher":{"@id":"http:\/\/www.wunen.com\/#organization"},"image":{"@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","articleSection":["\u4fbf\u6377\u751f\u6d3b"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/","url":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/","name":"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09 - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","isPartOf":{"@id":"http:\/\/www.wunen.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage"},"image":{"@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","datePublished":"2025-04-17T16:00:10+00:00","breadcrumb":{"@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#primaryimage","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","width":260,"height":180},{"@type":"BreadcrumbList","@id":"https:\/\/www.wunen.com\/index.php\/2025\/04\/18\/%e4%bb%8e%e7%94%9f%e6%b4%bb%e4%b8%ad%e9%a2%86%e6%82%9f%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%ef%bc%88python%ef%bc%89\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.wunen.com\/"},{"@type":"ListItem","position":2,"name":"\u4ece\u751f\u6d3b\u4e2d\u9886\u609f\u8bbe\u8ba1\u6a21\u5f0f\uff08Python\uff09"}]},{"@type":"WebSite","@id":"http:\/\/www.wunen.com\/#website","url":"http:\/\/www.wunen.com\/","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","description":"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9","publisher":{"@id":"http:\/\/www.wunen.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.wunen.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"http:\/\/www.wunen.com\/#organization","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","url":"http:\/\/www.wunen.com\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","width":1024,"height":1024,"caption":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51"},"image":{"@id":"http:\/\/www.wunen.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"http:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8","name":"admin@wunen","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","caption":"admin@wunen"},"sameAs":["http:\/\/www.wunen.com"],"url":"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/"}]}},"_links":{"self":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/comments?post=841"}],"version-history":[{"count":0,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media\/215"}],"wp:attachment":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}