{"id":166022,"date":"2019-12-24T13:34:41","date_gmt":"2019-12-24T05:34:41","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=166022"},"modified":"2019-12-09T10:35:12","modified_gmt":"2019-12-09T02:35:12","slug":"python-bibao-fun","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/python-bibao-fun.html","title":{"rendered":"Python \u95ed\u5305\u51fd\u6570\u8bf4\u660e"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5728 Python \u4e2d\u5f88\u591a\u5730\u65b9\u90fd\u4f1a\u4f7f\u7528\u5230\u95ed\u5305\uff0c\u90a3\u4e48\u7a76\u7adf\u4ec0\u4e48\u53eb\u505a\u95ed\u5305\u5462\uff1f<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u5728\u4e00\u4e9b\u8bed\u8a00\u4e2d\uff0c\u5728\u51fd\u6570\u4e2d\u53ef\u4ee5\uff08\u5d4c\u5957\uff09\u5b9a\u4e49\u53e6\u4e00\u4e2a\u51fd\u6570\u65f6\uff0c\u5982\u679c\u5185\u90e8\u7684\u51fd\u6570\u5f15\u7528\u4e86\u5916\u90e8\u7684\u51fd\u6570\u7684\u53d8\u91cf\uff0c\u5219\u53ef\u80fd\u4ea7\u751f\u95ed\u5305\u3002\u95ed\u5305\u53ef\u4ee5\u7528\u6765\u5728\u4e00\u4e2a\u51fd\u6570\u4e0e\u4e00\u7ec4\u201c\u79c1\u6709\u201d\u53d8\u91cf\u4e4b\u95f4\u521b\u5efa\u5173\u8054\u5173\u7cfb\u3002\u5728\u7ed9\u5b9a\u51fd\u6570\u88ab\u591a\u6b21\u8c03\u7528\u7684\u8fc7\u7a0b\u4e2d\uff0c\u8fd9\u4e9b\u79c1\u6709\u53d8\u91cf\u80fd\u591f\u4fdd\u6301\u5176\u6301\u4e45\u6027\u3002<\/p>\n \u7b80\u800c\u8a00\u4e4b\uff0c \u95ed\u5305\u7684\u7279\u70b9\u5c31\u662f\u5185\u90e8\u51fd\u6570\u5f15\u7528\u4e86\u5916\u90e8\u51fd\u6570\u4e2d\u7684\u53d8\u91cf\u3002 \u5728Python\u4e2d\uff0c\u652f\u6301\u5c06\u51fd\u6570\u5f53\u505a\u5bf9\u8c61\u4f7f\u7528\uff0c\u4e5f\u5c31\u662f\u53ef\u4ee5\u5c06\u4e00\u4e2a\u51fd\u6570\u5f53\u505a\u666e\u901a\u53d8\u91cf\u4e00\u6837\u7528\u4f5c\u53e6\u4e00\u4e2a\u51fd\u6570\u7684\u53c2\u6570\u548c\u8fd4\u56de\u503c\u3002\u62e5\u6709\u6b64\u7c7b\u7279\u6027\u7684\u8bed\u8a00\uff0c\u4e00\u822c\u90fd\u652f\u6301\u95ed\u5305\u3002<\/p>\n \u95ed\u5305\u4e2d\u88ab\u5185\u90e8\u51fd\u6570\u5f15\u7528\u7684\u53d8\u91cf\uff0c\u4e0d\u4f1a\u56e0\u4e3a\u5916\u90e8\u51fd\u6570\u7ed3\u675f\u800c\u88ab\u91ca\u653e\u6389\uff0c\u800c\u662f\u4e00\u76f4\u5b58\u5728\u5185\u5b58\u4e2d\uff0c\u77e5\u9053\u5185\u90e8\u51fd\u6570\u88ab\u8c03\u7528\u7ed3\u675f\u3002<\/p>\n \u95ed\u5305\u51fd\u6570<\/strong><\/span><\/div>\n \u95ed\uff1a\u6307\u7684\u662f\u5b9a\u4e49\u5728\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570 \u57fa\u672c\u5f62\u5f0f\uff1a<\/p>\n def outer():\r\nname ='egon'\r\ndef inner():\r\nprint('my name is %s' %name)\r\nreturn inner\r\n# print(outer())\r\nf=outer()\r\nf()\r\n<\/pre>\n |