{"id":50548,"date":"2024-12-03T14:09:55","date_gmt":"2024-12-03T06:09:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/50548\/"},"modified":"2024-12-03T14:09:55","modified_gmt":"2024-12-03T06:09:55","slug":"python-%e5%87%bd%e6%95%b0%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e7%9b%b8%e4%ba%92%e4%bd%9c%e7%94%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/50548\/","title":{"rendered":"Python \u51fd\u6570\u5982\u4f55\u5b9e\u73b0\u76f8\u4e92\u4f5c\u7528\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python \u51fd\u6570\u5982\u4f55\u5b9e\u73b0\u76f8\u4e92\u4f5c\u7528\uff1f<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241122\/173225128767400e97bb40e.jpg\" class=\"aligncenter\" title=\"Python \u51fd\u6570\u5982\u4f55\u5b9e\u73b0\u76f8\u4e92\u4f5c\u7528\uff1f\u63d2\u56fe\" alt=\"Python \u51fd\u6570\u5982\u4f55\u5b9e\u73b0\u76f8\u4e92\u4f5c\u7528\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>python \u51fd\u6570\u4e2d\u7684\u76f8\u4e92\u4f5c\u7528\u7591\u60d1<\/strong><\/p>\n<p>\u5b66\u4e60 python \u51fd\u6570\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u7591\u60d1\u3002\u4f8b\u5982\uff0c\u4e24\u4e2a\u51fd\u6570\u662f\u5426\u53ef\u4ee5\u76f8\u4e92\u4f5c\u7528\uff1f\u4e3a\u4e86\u89e3\u7b54\u8fd9\u4e2a\u7591\u95ee\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre>def make_great(names):\n    for name in names:\n        name_1 = \"the great \" + name.title()\n        print(name_1)\n\ndef show_magicians(names):\n    for name in names:\n        print(name.title())\n\nnames = [\"a\", \"b\", \"c\", \"tutu\", \"mumu\"]\nmake_great(names)\nshow_magicians(names)<\/pre>\n<p>\u60a8\u5e0c\u671b\u5148\u8c03\u7528\u7b2c\u4e00\u4e2a\u51fd\u6570 make_great \u4fee\u6539\u5217\u8868 names\uff0c\u518d\u8c03\u7528\u7b2c\u4e8c\u4e2a\u51fd\u6570 show_magicians \u663e\u793a\u4fee\u6539\u540e\u7684\u5217\u8868\u3002\u7136\u800c\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5374\u65e0\u6cd5\u8fbe\u5230\u9884\u671f\u7684\u6548\u679c\uff0c\u56e0\u4e3a make_great \u51fd\u6570\u4e0d\u4f1a\u8fd4\u56de\u4efb\u4f55\u503c\uff0c\u56e0\u6b64 make_great(names) \u5b9e\u9645\u4e0a\u662f none\uff0c\u800c show_magicians(none) \u663e\u7136\u4e0d\u662f\u60a8\u60f3\u8981\u7684\u7ed3\u679c\u3002<\/p>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u60a8\u7684\u76ee\u6807\uff0c\u53ef\u4ee5\u4f7f\u7528 python \u7684 map \u51fd\u6570\u3002map \u51fd\u6570\u5c06\u4e00\u4e2a\u51fd\u6570\u5e94\u7528\u4e8e\u53ef\u8fed\u4ee3\u5bf9\u8c61\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff0c\u5176\u4e2d\u5305\u542b\u5e94\u7528\u51fd\u6570\u540e\u7684\u7ed3\u679c\u3002<\/p>\n<pre>def make_great(names):\n    return map(lambda name: \"the Great \" + name.title(), names)\n\ndef show_magicians(names):\n    for name in names:\n        print(name.title())\n\nnames = [\"A\", \"b\", \"c\", \"tutu\", \"mumu\"]\n\nshow_magicians(make_great(names))<\/pre>\n<p>\u5728\u8fd9\u4e2a\u4fee\u6539\u540e\u7684\u4ee3\u7801\u4e2d\uff0cmake_great \u51fd\u6570\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u4fee\u6539\u540e\u540d\u79f0\u7684\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff0c\u4f5c\u4e3a show_magicians \u51fd\u6570\u7684\u8f93\u5165\u3002\u8fd9\u6837\u4e00\u6765\uff0cshow_magicians \u51fd\u6570\u53ef\u4ee5\u6b63\u786e\u5730\u663e\u793a\u4fee\u6539\u540e\u7684\u540d\u79f0\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300aPython \u51fd\u6570\u5982\u4f55\u5b9e\u73b0\u76f8\u4e92\u4f5c\u7528\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u51fd\u6570\u5982\u4f55\u5b9e\u73b0\u76f8\u4e92\u4f5c\u7528\uff1f python \u51fd\u6570\u4e2d\u7684\u76f8\u4e92\u4f5c\u7528\u7591\u60d1 \u5b66\u4e60 python \u51fd\u6570\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u7591\u60d1\u3002\u4f8b\u5982\uff0c\u4e24\u4e2a\u51fd\u6570\u662f\u5426\u53ef\u4ee5\u76f8\u4e92\u4f5c\u7528\uff1f\u4e3a\u4e86\u89e3\u7b54\u8fd9\u4e2a\u7591\u95ee\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u4ee3\u7801\u793a\u4f8b\uff1a def make_great(names): for name in names: name_1 = &#8220;the great &#8221; + name.title() print(name_1) def show_magicians(names): for name in names: print(name.title()) names = [&#8220;a&#8221;, &#8220;b&#8221;, &#8220;c&#8221;, &#8220;tutu&#8221;, &#8220;mumu&#8221;] make_great(names) show_magicians(names) \u60a8\u5e0c\u671b\u5148\u8c03\u7528\u7b2c\u4e00\u4e2a\u51fd\u6570 make_great \u4fee\u6539\u5217\u8868 names\uff0c\u518d\u8c03\u7528\u7b2c\u4e8c\u4e2a\u51fd\u6570 show_magicians \u663e\u793a\u4fee\u6539\u540e\u7684\u5217\u8868\u3002\u7136\u800c\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5374\u65e0\u6cd5\u8fbe\u5230\u9884\u671f\u7684\u6548\u679c\uff0c\u56e0\u4e3a make_great \u51fd\u6570\u4e0d\u4f1a\u8fd4\u56de\u4efb\u4f55\u503c\uff0c\u56e0\u6b64 make_great(names) \u5b9e\u9645\u4e0a\u662f none\uff0c\u800c show_magicians(none) \u663e\u7136\u4e0d\u662f\u60a8\u60f3\u8981\u7684\u7ed3\u679c\u3002 \u4e3a\u4e86\u5b9e\u73b0\u60a8\u7684\u76ee\u6807\uff0c\u53ef\u4ee5\u4f7f\u7528 python \u7684 map \u51fd\u6570\u3002map [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-50548","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/50548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=50548"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/50548\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=50548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=50548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=50548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}