{"id":2253,"date":"2021-08-03T21:09:18","date_gmt":"2021-08-03T13:09:18","guid":{"rendered":"https:\/\/egonlin.com\/?p=2253"},"modified":"2022-02-07T11:22:15","modified_gmt":"2022-02-07T03:22:15","slug":"%e7%ac%ac%e4%b8%89%e8%8a%82%ef%bc%9a%e9%98%85%e8%af%bbflask%e4%b8%8a%e4%b8%8b%e6%96%87%e5%89%8d%e5%a4%95%e8%a1%a5%e5%85%85","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=2253","title":{"rendered":"\u7b2c\u4e09\u8282\uff1a\u9605\u8bfbflask\u4e0a\u4e0b\u6587\u524d\u5915\u8865\u5145"},"content":{"rendered":"<h1>8.3 \u9884\u8bfb\u6e90\u7801\u5fc5\u8981\u4e86\u89e3\u7684\u77e5\u8bc6\u70b9<\/h1>\n<p>\u5728\u9605\u8bfb\u6e90\u7801\u4e4b\u524d\uff0c\u6e90\u7801\u4e2d\u4f1a\u6d89\u53ca\u5230\u5f88\u591apython\u7c7b\u7684\u7279\u6b8a\u7684\u7528\u6cd5\u4ee5\u53ca\u7c7b\u5199\u597d\u7684\u529f\u80fd\u7ec4\u4ef6\uff0c\u6240\u4ee5\u8fd9\u91cc\u6211\u4eec\u505a\u4e00\u4e2a\u8865\u5145\uff0c\u4ee5\u4fbf\u4e8e\u63a5\u4e0b\u6765\u6e90\u7801\u7684\u9605\u8bfb<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2021\/08\/1554342931492.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2021\/08\/1554342931492.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>01 \u504f\u51fd\u6570<\/h2>\n<p>\u5f53\u51fd\u6570\u7684\u53c2\u6570\u4e2a\u6570\u592a\u591a\uff0c\u9700\u8981\u7b80\u5316\u65f6\uff0c\u4f7f\u7528<code>functools.partial<\/code>\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u51fd\u6570\uff0c\u8fd9\u4e2a\u65b0\u51fd\u6570\u53ef\u4ee5\u56fa\u5b9a\u4f4f\u539f\u51fd\u6570\u7684\u90e8\u5206\u53c2\u6570\uff0c\u4ece\u800c\u5728\u8c03\u7528\u65f6\u66f4\u7b80\u5355\u3002<\/p>\n<pre><code class=\"language-python\">from functools import partial\ndef func(a1,a2,a3):\n    print(a1,a2,a3)\n\nnew_func1 = partial(func,a1=1,a2=2)\nnew_func1(a3=3)\n\nnew_func2 = partial(func,1,2)\nnew_func2(3)\n\nnew_func3 = partial(func,a1=1)\nnew_func3(a2=2,a3=3)<\/code><\/pre>\n<p><strong>\u6ce8\u610f<\/strong>\uff1apartial\u62ec\u53f7\u5185\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u539f\u51fd\u6570\uff0c\u5176\u4f59\u53c2\u6570\u662f\u9700\u8981\u56fa\u5b9a\u7684\u53c2\u6570<\/p>\n<p><strong>\u6548\u679c\u56fe<\/strong>\uff1a<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2021\/08\/11-\u504f\u51fd\u6570-2.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2021\/08\/11-\u504f\u51fd\u6570-2.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>02 <code>__add__<\/code>\u7684\u4f7f\u7528<\/h2>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"2253\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"2253\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"5d13fc8ae6\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"7755f0f36d\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>8.3 \u9884\u8bfb\u6e90\u7801\u5fc5\u8981\u4e86\u89e3\u7684\u77e5\u8bc6\u70b9 \u5728\u9605\u8bfb\u6e90\u7801\u4e4b\u524d\uff0c\u6e90\u7801\u4e2d\u4f1a\u6d89\u53ca\u5230\u5f88\u591apython\u7c7b\u7684\u7279\u6b8a\u7684\u7528\u6cd5\u4ee5\u53ca\u7c7b\u5199\u597d\u7684\u529f\u80fd [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2525,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[272],"tags":[273],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/2253"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2253"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/2253\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/2525"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}