{"id":175902,"date":"2020-04-16T09:00:08","date_gmt":"2020-04-16T01:00:08","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=175902"},"modified":"2020-04-01T09:12:21","modified_gmt":"2020-04-01T01:12:21","slug":"python-lambda","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/python-lambda.html","title":{"rendered":"Python\u4e2dLambda\u4f7f\u7528\u8981\u6ce8\u610f\u7684\u51e0\u4e2a\u5730\u65b9"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nlambda\u88ab\u8ba4\u4e3a\u662f\u975e\u5e38Python\u7684\u8bed\u8a00\uff0c\u662fPython\u7f16\u7a0b\u4e2d\u6bd4\u8f83\u53d7\u6b22\u8fce\u7684\u529f\u80fd\u4e4b\u4e00\u3002 \u5982\u6b64\u4e4b\u591a\uff0c\u4ee5\u81f3\u4e8e\u8bb8\u591aPython\u7a0b\u5e8f\u5458\u90fd\u60f3\u5c3d\u53ef\u80fd\u5730\u4f7f\u7528\u5b83\u4eec\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

lambda\u88ab\u8ba4\u4e3a\u662f\u975e\u5e38Python\u7684\u8bed\u8a00\uff0c\u662fPython\u7f16\u7a0b\u4e2d\u6bd4\u8f83\u53d7\u6b22\u8fce\u7684\u529f\u80fd\u4e4b\u4e00\u3002 \u5982\u6b64\u4e4b\u591a\uff0c\u4ee5\u81f3\u4e8e\u8bb8\u591aPython\u7a0b\u5e8f\u5458\u90fd\u60f3\u5c3d\u53ef\u80fd\u5730\u4f7f\u7528\u5b83\u4eec\u3002<\/p>\n

\"\"<\/p>\n

\u5f53\u7136\uff0clambda\u5177\u6709\u4f7f\u6211\u4eec\u7684\u4ee3\u7801\u7b80\u6d01\u7684\u4f18\u52bf\uff0c\u4f46\u662f\u5728\u9879\u76ee\u4e2d\u8fc7\u5ea6\u4f7f\u7528\u5b83\u4eec\u4f1a\u5bfc\u81f4\u6ee5\u7528\uff0c\u4ece\u800c\u964d\u4f4e\u6211\u4eec\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n

\u5728\u5f00\u59cb\u7814\u7a76\u8fd9\u4e9b\u8bef\u7528\u662f\u4ec0\u4e48\u4e4b\u524d\uff0c\u8ba9\u6211\u4eec\u5148\u5feb\u901f\u56de\u987e\u4e00\u4e0blambda\u3002 \u5982\u679c\u60a8\u5bf9\u5b83\u4eec\u975e\u5e38\u4e86\u89e3\uff0c\u5219\u53ef\u4ee5\u8df3\u5230\u4e0b\u4e00\u90e8\u5206\u3002<\/p>\n

Lambda\uff0c\u4e5f\u79f0\u4e3alambda\u51fd\u6570\uff0c\u662f\u533f\u540d\u51fd\u6570\uff0c\u53ef\u4ee5\u63a5\u53d7\u4efb\u610f\u6570\u91cf\u7684\u53c2\u6570\uff0c\u800c\u53ea\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u3002 \u5b83\u4eec\u7684\u58f0\u660e\u7531lambda\u5173\u952e\u5b57\u8868\u793a\u3002 \u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\u3002<\/p>\n

lambda arguments: expression \r\n<\/pre>\n

Lambda\u6700\u9002\u5408\u9700\u8981\u5c0f\u7684\u529f\u80fd\u4e14\u4ec5\u4f7f\u7528\u4e00\u6b21\u7684\u5730\u65b9\u3002 lambda\u7684\u4e00\u79cd\u5e38\u89c1\u7528\u6cd5\u662f\u5c06\u5176\u8bbe\u7f6e\u4e3a\u5185\u7f6esorted()\u51fd\u6570\u4e2d\u7684\u5173\u952e\u53c2\u6570\u3002 \u8fd9\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n

>>> students = [('Mike', 'M', 15), ('Mary', 'F', 14), ('David', 'M', 16)] \r\n>>> sorted(students, key=lambda x: x[2]) \r\n[('Mary', 'F', 14), ('Mike', 'M', 15), ('David', 'M', 16)] \r\n# The students are sorted by age \r\n<\/pre>\n

\u8bb8\u591a\u6559\u7a0b\u5728\u89e3\u91calambda\u662f\u4ec0\u4e48\u4ee5\u53ca\u53ef\u4ee5\u5728\u54ea\u91cc\u4f7f\u7528lambda\u65b9\u9762\u505a\u5f97\u5f88\u597d\uff0c\u56e0\u6b64\uff0c\u6ca1\u6709\u5145\u5206\u7684\u7406\u7531\u5728\u8fd9\u91cc\u91cd\u590d\u5927\u91cf\u7684\u8bb2\u89e3\u3002<\/p>\n

\u76f8\u53cd\uff0c\u672c\u6587\u7684\u76ee\u7684\u662f\u5411\u60a8\u5c55\u793a\u6700\u5e38\u89c1\u7684lambda\u8bef\u7528\uff0c\u4ee5\u4fbf\u5728\u4ee5\u4e0b\u6240\u5217\u60c5\u51b5\u4ee5\u5916\u7684\u5176\u4ed6\u60c5\u51b5\u4e0b\u4f7f\u7528lambda\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u6b63\u786e\u4f7f\u7528\u5b83\u4eec\u3002<\/p>\n

1.\u91cd\u65b0\u53d1\u660e\u8f6e\u5b50<\/strong><\/span><\/div>\n

lambdas\u7684\u7b2c\u4e00\u4e2a\u8bef\u7528\u662f\u5ffd\u7565\u4e86\u73b0\u6709\u7684\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n

\u8ba9\u6211\u4eec\u4ecd\u7136\u4ee5sorted()\u51fd\u6570\u4e3a\u4f8b\u3002 \u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5b57\u7b26\u4e32\u5217\u8868\uff0c\u6211\u4eec\u60f3\u4f7f\u7528\u5b83\u4eec\u7684\u957f\u5ea6\u5bf9\u5b83\u4eec\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n

\u5f53\u7136\uff0clambda\u51fd\u6570lambda x\uff1alen(x)\u53ef\u4ee5\u5de5\u4f5c\uff0c\u4f46\u662f\u76f4\u63a5\u4f7f\u7528\u5185\u7f6e\u7684len()\u51fd\u6570\u600e\u4e48\u6837?<\/p>\n

>>> pets = ['dog', 'turtle', 'bird', 'fish', 'kitty'] \r\n>>> sorted(pets, key=lambda x: len(x)) \r\n['dog', 'bird', 'fish', 'kitty', 'turtle'] \r\n# The built-in len() function \r\n>>> sorted(pets, key=len) \r\n['dog', 'bird', 'fish', 'kitty', 'turtle'] \r\n<\/pre>\n

\u8fd9\u662f\u53e6\u4e00\u4e2a\u6d89\u53ca\u4f7f\u7528max()\u51fd\u6570\u7684\u793a\u4f8b\u3002<\/p>\n

>>> number_tuples = [(4, 5, 7), (3, 1, 2), (9, 4, 1)] \r\n>>> sorted(number_tuples, key=lambda x: max(x)) \r\n[(3, 1, 2), (4, 5, 7), (9, 4, 1)] \r\n# The built-in max() function \r\n>>> sorted(number_tuples, key=max) \r\n[(3, 1, 2), (4, 5, 7), (9, 4, 1)] \r\n<\/pre>\n

\u4f18\u79c0\u5b9e\u8df51\uff1a\u5728\u7f16\u5199\u81ea\u5df1\u7684Lambda\u4e4b\u524d\u5148\u8003\u8651\u4e00\u4e0b\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n

2.\u5c06\u5176\u5206\u914d\u7ed9\u53d8\u91cf<\/strong><\/span><\/div>\n

\u5728\u4e00\u4e9b\u6559\u7a0b(\u5305\u62ec\u6211\u7684\u4e00\u4e9b\u6559\u7a0b)\u4e2d\uff0c\u6211\u5df2\u7ecf\u770b\u5230\u4e86\u5c06lambdas\u5206\u914d\u7ed9\u53d8\u91cf\u7684\u65b9\u6cd5\uff0c\u4f46\u662f\u5b83\u4e3b\u8981\u662f\u5411\u521d\u5b66\u8005\u5c55\u793alambdas\u672c\u8d28\u4e0a\u662f\u51fd\u6570\u3002<\/p>\n

\u4f46\u662f\uff0c\u67d0\u4e9b\u521d\u5b66\u8005\u53ef\u80fd\u5df2\u5c06\u5176\u4f5c\u4e3a\u4e00\u79cd\u597d\u4e60\u60ef\uff0c\u5e76\u8ba4\u4e3alambda\u53ea\u662f\u58f0\u660e\u77ed\u51fd\u6570\u7684\u4fbf\u6377\u65b9\u5f0f\u3002 \u4ee5\u4e0b\u4ee3\u7801\u7247\u6bb5\u5411\u60a8\u5c55\u793a\u4e86\u8fd9\u79cd\u6ee5\u7528\u3002<\/p>\n

>>> divide_two_numbers = lambda x, y: x \/ y \r\n>>> divide_two_numbers(4, 5) \r\n0.8 \r\n<\/pre>\n

\u4e3a\u4ec0\u4e48\u8981\u907f\u514d\u8fd9\u79cd\u60c5\u51b5? \u5982\u679c\u60a8\u8fd8\u8bb0\u5f97\u4e0a\u9762\u63d0\u5230\u7684\u5185\u5bb9\uff0c\u90a3\u4e48lambda\u5e94\u8be5\u53ea\u4f7f\u7528\u4e00\u6b21\uff0c\u56e0\u6b64\u6ca1\u6709\u7406\u7531\u5c06lambda\u5206\u914d\u7ed9\u53d8\u91cf\u3002<\/p>\n

\u5982\u679c\u786e\u5b9e\u9700\u8981\u4f7f\u7528\u76f8\u5173\u529f\u80fd\uff0c\u5219\u5e94\u4f7f\u7528def\u5173\u952e\u5b57\u6765\u58f0\u660e\u4e00\u4e2a\u5e38\u89c4\u51fd\u6570\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n

\u5982\u679c\u60a8\u8ba4\u4e3a\u4f7f\u7528\u6b64\u7b80\u5355\u529f\u80fd\u7684\u4e24\u884c\u4ee3\u7801\u5e76\u4e0d\u9177\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u91cd\u5199\u4e3a\u4e00\u884c\uff1adefdivid_two_numbers_fun(x\uff0cy)\uff1a\u8fd4\u56dex \/ y\uff0c\u5176\u5de5\u4f5c\u65b9\u5f0f\u76f8\u540c\u3002<\/p>\n

>>> def divide_two_numbers_fun(x,y):  \r\n...     return x \/ y \r\n...  \r\n>>> divide_two_numbers_fun(7, 8) \r\n0.875 \r\n<\/pre>\n

\u907f\u514d\u4e3a\u53d8\u91cf\u5206\u914dlambda\u7684\u4e3b\u8981\u539f\u56e0\u662f\u51fa\u4e8e\u8c03\u8bd5\/\u7ef4\u62a4\u7684\u76ee\u7684\uff0c\u5c24\u5176\u662f\u5728\u751f\u4ea7\/\u56e2\u961f\u5408\u4f5c\u73af\u5883\u4e2d\u3002<\/p>\n

\u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u53ef\u80fd\u53d1\u751f\u7684\u4e8b\u60c5\u3002 \u5728\u5b9e\u9645\u60c5\u51b5\u4e0b\uff0c\u4e8b\u60c5\u53ef\u80fd\u4f1a\u53d8\u5f97\u590d\u6742\u5f97\u591a\u3002<\/p>\n

>>> divide_two_numbers(3, 0) \r\nTraceback (most recent call last): \r\n  File \"\", line 1, in  \r\n  File \"\", line 1, in  \r\nZeroDivisionError: division by zero \r\n>>> divide_two_numbers_fun(3, 0) \r\nTraceback (most recent call last): \r\n  File \"\", line 1, in  \r\n  File \"\", line 1, in divide_two_numbers_fun \r\nZeroDivisionError: division by zero \r\n<\/pre>\n

\u5982\u60a8\u5728\u4e0a\u9762\u770b\u5230\u7684\uff0c\u901a\u8fc7\u5e38\u89c4\u51fd\u6570\u7684\u58f0\u660e\uff0c\u6211\u4eec\u786e\u5207\u5730\u77e5\u9053\u54ea\u4e2a\u51fd\u6570\u5bfc\u81f4\u4e86\u9519\u8bef\u3002 \u76f8\u6bd4\u4e4b\u4e0b\uff0c\u4f7f\u7528lambda\u53ea\u80fd\u544a\u8bc9\u6211\u4eec\u5b58\u5728\u4e00\u4e2alambda\u5bfc\u81f4\u9519\u8bef\u3002<\/p>\n

\u4e3a\u4ec0\u4e48\u6ca1\u6709\u663e\u793a\u529f\u80fd\u540d\u79f0?<\/p>\n

\u8fd9\u662f\u56e0\u4e3alambda\u662f\u533f\u540d\u51fd\u6570\uff0c\u6240\u6709\u8fd9\u4e9b\u51fd\u6570\u90fd\u5177\u6709\u76f8\u540c\u7684\u540d\u79f0-\u3002 \u60a8\u80fd\u60f3\u8c61\u5982\u679c\u60a8\u7684\u540c\u4e8b\u53d1\u73b0\u6570\u5341\u4e2a\u5b58\u5728\u9519\u8bef\u4f1a\u591a\u4e48\u4ee4\u4eba\u6cae\u4e27?<\/p>\n

\u4f18\u79c0\u5b9e\u8df52\uff1a\u8981\u591a\u6b21\u4f7f\u7528\u5e38\u89c4\u51fd\u6570\u800c\u4e0d\u662flambda\u3002<\/p>\n

3.\u9ad8\u9636\u51fd\u6570\u4f7f\u7528\u4e0d\u5f53<\/strong><\/span><\/div>\n

\u5f53\u6211\u4eec\u8bf4\u9ad8\u9636\u51fd\u6570\u65f6\uff0c\u662f\u6307\u53ef\u4ee5\u901a\u8fc7\u5c06\u51fd\u6570\u4f5c\u4e3a\u53c2\u6570\u6216\u901a\u8fc7\u8fd4\u56de\u51fd\u6570\u6765\u5bf9\u5176\u4ed6\u51fd\u6570\u8fdb\u884c\u64cd\u4f5c\u7684\u51fd\u6570\u3002<\/p>\n

\u4e0e\u5f53\u524d\u4e3b\u9898\u76f8\u5173\u7684\u51fd\u6570\u662fmap()\uff0cfilter()\u548creduce()\uff0c\u5b83\u4eec\u5728lambda\u7684\u8bb8\u591a\u6559\u7a0b\u4e2d\u90fd\u5df2\u6216\u591a\u6216\u5c11\u5730\u88ab\u4f7f\u7528\u3002 \u4f46\u662f\uff0c\u8fd9\u5bfc\u81f4\u5bf9lambda\u4ee5\u53ca\u66f4\u9ad8\u9636\u51fd\u6570\u7684\u67d0\u79cd\u6ee5\u7528\u3002<\/p>\n

\u51fa\u4e8e\u6f14\u793a\u76ee\u7684\uff0c\u6211\u5c06\u5728\u672c\u6559\u7a0b\u4e2d\u4ec5\u4f7f\u7528map()\u51fd\u6570\uff0c\u4f46\u76f8\u540c\u7684\u539f\u7406\u4e5f\u9002\u7528\u4e8e\u5176\u4ed6\u9ad8\u9636\u51fd\u6570\u3002<\/p>\n

\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u6574\u6570\u5217\u8868\uff0c\u5e76\u4e14\u5e0c\u671b\u6709\u4e00\u4e2a\u5305\u542b\u5b83\u4eec\u7684\u5e73\u65b9\u7684\u5217\u8868\u3002 \u4e0b\u9762\u5c06lambda\u4e0emap()\u51fd\u6570\u4e00\u8d77\u4f7f\u7528\u3002<\/p>\n

\u6211\u4eec\u5c06\u83b7\u5f97\u4e00\u4e2a\u8fed\u4ee3\u5668-map()\u51fd\u6570\u4e2d\u7684map\u5bf9\u8c61\uff0c\u7136\u540e\u5c06\u5176\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u6211\u4eec\u9700\u8981\u5728\u6b64\u8fed\u4ee3\u5668\u4e0a\u8c03\u7528list()\u51fd\u6570\u3002<\/p>\n

>>> numbers = [1, 2, 3, 5, 8] \r\n>>> squares = list(map(lambda x: x * x, numbers)) \r\n>>> squares \r\n[1, 4, 9, 25, 64] \r\n<\/pre>\n

\u5b9e\u9645\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u5217\u8868\u7406\u89e3\u65b9\u4fbf\u5730\u5b9e\u73b0\u76f8\u540c\u7684\u529f\u80fd-\u4e0d\u9700\u8981\u9ad8\u9636\u51fd\u6570\u6216lambda\u3002 \u66f4\u52a0\u7b80\u6d01\u6613\u8bfb\uff0c\u4e0d\u662f\u5417?<\/p>\n

\u5f53\u7136\uff0c\u638c\u63e1\u5217\u8868\u7406\u89e3\u80fd\u529b\u662f\u53e6\u4e00\u4e2a\" Pythonic\u529f\u80fd\"\u4e3b\u9898\uff0c\u9700\u8981\u53e6\u4e00\u4e2a\u6559\u7a0b\u3002<\/p>\n

>>> numbers = [1, 2, 3, 5, 8] \r\n>>> squares = [x * x for x in numbers] \r\n>>> squares \r\n[1, 4, 9, 25, 64] \r\n<\/pre>\n

\u4f18\u79c0\u5b9e\u8df53\uff1a\u8003\u8651\u4f7f\u7528\u5e26\u5217\u8868\u63a8\u5bfc\u7684lambda\u66ff\u6362\u9ad8\u9636\u51fd\u6570\u3002<\/p>\n

4.\u8868\u8fbe\u5f0f\u592a\u7b28\u62d9<\/strong><\/span><\/div>\n

\u8fd9\u6bd4\u4ee5\u524d\u7684\u65b9\u6cd5\u5c11\u89c1\u3002 \u4f46\u662f\u4e00\u4e9b\u7a0b\u5e8f\u5458\u53ea\u662f\u5c3d\u53ef\u80fd\u5730\u4f7f\u7528lambda\u6765\u52aa\u529b\u7f16\u5199\u6700\u591a\u7684Python\u4ee3\u7801\u3002 \u6709\u65f6\u9700\u8981\u4ed8\u51fa\u4e00\u5b9a\u7684\u4ee3\u4ef7-\u53ef\u8bfb\u6027\u3002<\/p>\n

\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5b57\u7b26\u4e32\u5217\u8868\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u4e00\u4e2a\u5947\u602a\u7684\u8981\u6c42\u5bf9\u5b83\u4eec\u8fdb\u884c\u6392\u5e8f\uff1a\u5355\u8bcd\u4e2d\u4e0d\u540c\u5143\u97f3\u7684\u6570\u91cf\u3002 \u5728sorted()\u51fd\u6570\u4e2d\u4f7f\u7528lambda\u5982\u4e0b\u6240\u793a\u3002<\/p>\n

>>> texts = ['iiiii', 'bag', 'beto', 'blackboard', 'sequoia'] \r\n>>> sorted(texts, key=lambda x: len(set([l for l in list(x) if l in ['a','e','i','o','u']]))) \r\n['iiiii', 'bag', 'beto', 'blackboard', 'sequoia'] \r\n<\/pre>\n

\u5b83\u53ef\u4ee5\u6309\u9884\u671f\u5de5\u4f5c\uff0c\u4f46\u7edd\u5bf9\u4e0d\u662f\u6700\u6613\u8bfb\u7684\u4ee3\u7801\u3002 \u4e0b\u9762\u7684\u4ee3\u7801\u600e\u4e48\u6837?<\/p>\n

>>> texts = ['iiiii', 'bag', 'beto', 'blackboard', 'sequoia'] \r\n>>> def number_distinct_vowels(x): \r\n...     vowels = ['a', 'e', 'i', 'o', 'u'] \r\n...     vowels_only = [l for l in list(x) if l in vowels] \r\n...     distinct_vowels = set(all_vowels) \r\n...     return len(distinct_vowels) \r\n...  \r\n>>> sorted(texts, key=number_distinct_vowels) \r\n['iiiii', 'bag', 'beto', 'blackboard', 'sequoia'] \r\n<\/pre>\n

\u5f53\u7136\uff0c\u6211\u4eec\u9700\u8981\u518d\u5199\u51e0\u884c\u4ee3\u7801\uff0c\u4f46\u662f\u65b0\u4ee3\u7801\u96be\u9053\u4e0d\u5177\u6709\u66f4\u597d\u7684\u53ef\u8bfb\u6027\u5417?<\/p>\n

\u4f18\u79c0\u5b9e\u8df54\uff1a\u5982\u679clambda\u7684\u8868\u8fbe\u5f0f\u8fc7\u4e8e\u7e41\u7410\uff0c\u5219\u7f16\u5199\u4e00\u4e2a\u6b63\u5219\u51fd\u6570\u3002<\/p>\n

\u603b\u7ed3<\/strong><\/span><\/div>\n

Lambda\u4e00\u76f4\u662fPython\u521d\u5b66\u8005\u7684\u786c\u4e3b\u9898\u4e4b\u4e00\uff0c\u4ed6\u4eec\u4e00\u5f00\u59cb\u5c31\u4e0d\u60dc\u4e00\u5207\u4ee3\u4ef7\u907f\u514d\u4f7f\u7528\u5b83\u4eec\u3002<\/p>\n

\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u5f53\u6050\u60e7\u6d88\u5931\u65f6\uff0c\u4ed6\u4eec\u5f00\u59cb\u5b66\u4e60lambda\uff0c\u5e76\u53d1\u73b0\u81ea\u5df1\u4e00\u70b9\u4e5f\u4e0d\u96be\u3002 \u7136\u540e\uff0c\u5b83\u4eec\u5f00\u59cb\u4f7f\u7528lambda\uff0c\u4f46\u4e0d\u5e78\u7684\u662f\uff0c\u6709\u4e9b\u4eba\u53ef\u80fd\u8fc7\u591a\u5730\u4f7f\u7528\u4e86lambda\uff0c\u5bfc\u81f4\u5982\u4e0a\u6240\u8ff0\u7684\u5404\u79cd\u6ee5\u7528\u3002<\/p>\n

\u6211\u5e0c\u671b\u672c\u6587\u53ef\u4ee5\u5e2e\u52a9\u89e3\u51b3\u5176\u4e2d\u4e00\u4e9b\u95ee\u9898\u3002<\/p>\n

\u901a\u8fc7\u907f\u514d\u8fd9\u4e9b\u8bef\u7528\u5e76\u9075\u5faa\u4f18\u79c0\u5b9e\u8df5\u6280\u5de7\uff0c\u6211\u6562\u6253\u8d4c\uff0c\u6b63\u786e\u4f7f\u7528lambda\u7684Python\u4ee3\u7801\u5c06\u5177\u6709\u66f4\u597d\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

lambda\u88ab\u8ba4\u4e3a\u662f\u975e\u5e38Python\u7684\u8bed\u8a00\uff0c\u662fPython\u7f16\u7a0b\u4e2d\u6bd4\u8f83\u53d7\u6b22\u8fce\u7684\u529f\u80fd\u4e4b\u4e00\u3002 \u5982\u6b64\u4e4b\u591a\uff0c\u4ee5\u81f3\u4e8e\u8bb8\u591aP […]<\/p>\n","protected":false},"author":1898,"featured_media":175905,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[550],"class_list":["post-175902","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-lambda"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/175902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=175902"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/175902\/revisions"}],"predecessor-version":[{"id":175914,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/175902\/revisions\/175914"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/175905"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=175902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=175902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=175902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}