{"id":1059,"date":"2023-03-24T09:47:07","date_gmt":"2023-03-24T01:47:07","guid":{"rendered":""},"modified":"2023-03-24T09:47:07","modified_gmt":"2023-03-24T01:47:07","slug":"Python lambda","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1059.html","title":{"rendered":"Python lambda"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

Python lambda<\/h1>\n

\u641e\u61c2Python lambda\u8868\u8fbe\u5f0f\u7684\u7528\u6cd5<\/span>\n <\/div>\n

lambda\u662f\u4ec0\u4e48\uff1f<\/h2>\n
\n Lambda\u8868\u8fbe\u4e86Python\u4e2d\u7528\u4e8e\u521b\u5efa\u533f\u540d\u51fd\u6570\u7684\u7279\u6b8a\u8bed\u6cd5\u3002\u6211\u4eec\u5c06lambda\u8bed\u6cd5\u672c\u8eab\u79f0\u4e3alambda\u8868\u8fbe\u5f0f\uff0c\u4ece\u8fd9\u91cc\u5f97\u5230\u7684\u51fd\u6570\u79f0\u4e4b\u4e3alambda\u51fd\u6570\u3002\u5176\u5b9e\u603b\u7ed3\u8d77\u6765\uff0clambda\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e00\u4e2a\u5c0f\u7684\u533f\u540d\u51fd\u6570\uff0clambda\u51fd\u6570\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u6570\u91cf\u7684\u53c2\u6570\uff0c\u4f46\u53ea\u80fd\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u3002\u5177\u4f53\u51fd\u6570\u8868\u8fbe\u5f0f\u5982\u4e0b\uff1a\n <\/div>\n

\u6a21\u677f\uff1a lambda argument: manipulate(argument)<\/span>
\n \u53c2\u6570\uff1aargument\u5c31\u662f\u8fd9\u4e2a\u533f\u540d\u51fd\u6570\u4f20\u5165\u7684\u53c2\u6570\uff0c\u5192\u53f7\u540e\u9762\u662f\u6211\u4eec\u5bf9\u8fd9\u4e2a\u53c2\u6570\u7684\u64cd\u4f5c\u65b9\u6cd5<\/span> <\/p>\n

\n \u53c2\u8003\u4e0a\u9762\u7684\u5b9a\u4e49\u6a21\u677f\u548c\u53c2\u6570, \u76f4\u63a5\u770b\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u4f8b\u5b50:\n <\/div>\n
\n
 add_one = lambda <\/span>x:x+1 # 1\u4e2a\u53c2\u6570\uff0c\u6267\u884c\u64cd\u4f5c\u4e3a+1
<\/span> add_nums = lambda <\/span>x,y:x+y # 2\u4e2a\u53c2\u6570\uff0c\u6267\u884c\u64cd\u4f5c\u4e3a\u76f8\u52a0
<\/span> print(add_one(2)) # \u8c03\u7528add_one
<\/span> print(add_nums(3,7)) # \u8c03\u7528add_nums
<\/span> <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 3
10 <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5927\u5bb6\u53ef\u80fd\u5df2\u7ecf\u53d1\u73b0lambda\u533f\u540d\u51fd\u6570\u7684\u7279\u70b9\u4e86\uff0c\u5c31\u662f\u5bf9\u4e8e\u8f83\u4e3a\u7b80\u5355\u7684\u529f\u80fd\uff0c\u65e0\u9700\u81ea\u5df1def\u4e00\u4e2a\u4e86\uff0c\u5355\u884c\u5c31\u53ef\u4ee5\u5199\u4e0b\uff0c\u4f20\u53c2\u548c\u6267\u884c\u65b9\u6cd5\u4e00\u6c14\u5475\u6210\n <\/div>\n

lambda\u7528\u6cd5\u8be6\u89e3<\/h2>\n
\n \u63a5\u4e0b\u6765\u8ba9\u6211\u4eec\u770b\u770blambda\u7684\u5b9e\u9645\u5e94\u7528\uff0c\u5c31\u6211\u81ea\u5df1\u4f7f\u7528lambda\u7684\u4f53\u9a8c\u6765\u8bf4\uff0c\u4ece\u6765\u6ca1\u6709\u5355\u72ec\u7528\u8fc7\uff0clambda\u4e00\u822c\u60c5\u51b5\u4e0b\u662f\u548cmap\uff0cfilter\uff0creduce\u8fd9\u4e9b\u8d85\u68d2\u7684\u5185\u7f6e\u51fd\u6570\u4ee5\u53cadict\uff0clist\uff0ctuple\uff0cset\u7b49\u6570\u636e\u7ed3\u6784\u6df7\u7528\uff0c\u8fd9\u6837\u624d\u80fd\u53d1\u6325\u5b83\u7684\u6700\u5927\u6548\u679c\uff0c\u4e0b\u9762\u8ba9\u6211\u4eec\u4e00\u4e2a\u4e2a\u6765\u770b\u3002\n <\/div>\n

lambda + map<\/h3>\n
\n \u9996\u5148\u6765\u770blambda+map\u7684\u7ec4\u5408\uff0c\u5148\u770b\u4e0b\u9762\u8fd9\u4e2a\u4f8b\u5b50\uff1a\n <\/div>\n
\n
 numbers = [1,2,3,4,5]
add_one = list(map(lambda <\/span>n:n+1,numbers)) #map(fun,sequence)
<\/span> print(list(add_one))
print(tuple(add_one))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 [2, 3, 4, 5, 6]
(2, 3, 4, 5, 6) <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5b9e\u73b0\u4e00\u4e2a\u6570\u7ec4\uff08\u5143\u7ec4\uff09\u6bcf\u4e2a\u5143\u7d20+1\uff0c\u8ba9\u6211\u4eec\u56de\u5fc6\u4e00\u4e0bmap\u7684\u7528\u6cd5map(fun,sequence)\uff0cfun\u662f\u4f20\u9012\u7684\u65b9\u6cd5\uff0csequence\u662f\u4e00\u4e2a\u53ef\u8fed\u4ee3\u7684\u5e8f\u5217\uff0c\u8fd9\u91cc\u6211\u4eec\u7684fun\u5c31\u662f\u533f\u540d\u51fd\u6570lambda n:n+1\uff0c\u8fd9\u91cc\u975e\u5e38\u5b8c\u7f8e\u7684\u89e3\u91ca\u4e86lambda\u7684\u8bbe\u8ba1\u521d\u8877\uff0c\u56e0\u4e3a\u5982\u679c\u6ca1\u6709lambda\uff0c\u6211\u4eec\u7684\u89e3\u51b3\u65b9\u6848\u662f\u8fd9\u6837:\n <\/div>\n
\n
 def <\/span>add(num):
    return <\/span>num+1
numbers = [1,2,3,4,5]
add_one = list(map(add,numbers))
print(add_one)
print(tuple(add_one))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u663e\u7136\u6613\u89c1\uff0c\u8fd9\u91cc\u7684add\u65b9\u6cd5\u6709\u70b9\u591a\u4f59\uff0c\u6240\u4ee5\u7528lambda\u4ee3\u66ff\u662f\u4e2a\u597d\u7684\u9009\u62e9\u3002\u8ba9\u6211\u4eec\u518d\u770b\u4e0b\u4e00\u4e2a\u4f8b\u5b50\n <\/div>\n
\n
 from <\/span>datetime import <\/span>datetime as <\/span>dt
logs = ['serverLog'<\/span>,'appLog'<\/span>,'paymentLog'<\/span>]
format ='_{}.py'<\/span>.format<\/span>(dt.now<\/span>().strftime<\/span>('%d-%m-%y'<\/span>))
result =list(map(lambda <\/span>x:x+format,logs)) # \u5229\u7528map+lambda <\/span>\u5b9e\u73b0\u5b57\u7b26\u4e32\u62fc\u63a5
<\/span> print(result)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 ['serverLog_26-07-20.py', 'appLog_26-07-20.py', 'paymentLog_26-07-20.py'] <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u91cc\u548c\u521a\u624d\u7684\u52a01\u4f8b\u5b50\u5dee\u4e0d\u591a\uff0c\u4f46\u662f\u6362\u6210\u4e86\u5b57\u7b26\u4e32\u7684\u62fc\u63a5\uff0c\u7136\u800c\u6211\u8fd9\u91cc\u7528lambda\u5e76\u4e0d\u662f\u5f88\u597d\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u6700\u540e\u6211\u4eec\u4f1a\u8bf4\uff0c\u73b0\u5728\u5927\u5bb6\u5e94\u8be5\u5bf9map + lambda \u6709\u4e00\u4e9b\u611f\u89c9\u4e86\uff0c\u8ba9\u6211\u4eec\u518d\u6765\u4e2a\u548cdict\u5b57\u5178\u4e92\u52a8\u7684\u4f8b\u5b50\uff1a\n <\/div>\n
\n
 person =[{'name'<\/span><\/span><\/span>:'XiaoMing'<\/span>,
          'city'<\/span><\/span>:'beijing'<\/span>},
         {'name':'XiaoLi'<\/span>,
          'city':'shanghai'<\/span>}]
names=list(map(lambda <\/span>x:x['name'],person))
print(names)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 ['XiaoMing', 'XiaoLi'] <\/span><\/code><\/pre>\n<\/p><\/div>\n

lambda + filter<\/h3>\n
\n lambda\u548cfilter\u7684\u7ec4\u5408\u4e5f\u5f88\u5e38\u89c1\uff0c\u7528\u4e8e\u7279\u5b9a\u7b5b\u9009\u6761\u4ef6\u4e0b\uff0c\u73b0\u5728\u8ba9\u6211\u4eec\u6765\u770b\u4e0a\u7bc7\u6587\u7ae0filter\u7684\u4f8b\u5b50\uff0c\u5c31\u5e94\u8be5\u5f88\u597d\u7406\u89e3\u4e86\uff1a\n <\/div>\n
\n
 numbers = [0, 1, 2, -3, 5, -8, 13]
# \u63d0\u53d6\u5947\u6570
<\/span> result = filter(lambda <\/span>x: x % 2, numbers)
print(\"Odd Numbers are :\"<\/span>,list(result))
# \u63d0\u53d6\u5076\u6570
<\/span> result = filter(lambda <\/span>x: x % 2 == 0, numbers)
print(\"Even Numbers are :\"<\/span>,list(result))
# \u63d0\u53d6\u6b63\u6570
<\/span> result = filter(lambda <\/span>x: x>0, numbers)
print(\"Positive Numbers are :\"<\/span>,list(result))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 Odd Numbers are : [1, -3, 5, 13]
Even Numbers are : [0, 2, -8]
Positive Numbers are : [1, 2, 5, 13]
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u91cc\u5c31\u662f\u6211\u4eec\u628afilter(fun,sequence)\u91cc\u9762\u7684fun\u6362\u6210\u4e86\u6211\u4eec\u7684lambda\uff0c\u53ea\u662flambda\u7684\u51fd\u6570\u90e8\u5206\uff08x%2,x%2==0,x>0\uff09\u90fd\u662f\u53ef\u4ee5\u8fd4\u56deTrue\u6216\u8005False\u6765\u5224\u65ad\u7684\uff0c\u7b26\u5408fiter\u7684\u8981\u6c42\u3002\n <\/div>\n
\n
 person =[{'name'<\/span><\/span><\/span>:'XiaoMing'<\/span>,
          'city'<\/span><\/span>:'beijing'<\/span>},
         {'name':'XiaoLi'<\/span>,
          'city':'shanghai'<\/span>}]
names=list(filter(lambda <\/span>x:x['name']=='XiaoMing'<\/span>,person))
print(names)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 [{'name': 'XiaoMing', 'city': 'beijing'}] <\/span><\/code><\/pre>\n<\/p><\/div>\n

lambda + reduce<\/h3>\n
\n \u6211\u4eec\u76f4\u63a5\u770b\u4e00\u4e2a\u4f8b\u5b50\n <\/div>\n
\n
 from <\/span>functools import <\/span>reduce # Only Python 3
<\/span> numbers = [1,2,3,4]
result_multiply = reduce((lambda <\/span>x, y: x * y), numbers)
result_add = reduce((lambda <\/span>x,y: x+y), numbers)
print(result_multiply)
print(result_add)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 24
10 <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u4e2a\u4f8b\u5b50\u7528lambda\u548creduce\u7684\u914d\u5408\u5b9e\u73b0\u4e86list\u6c42\u7d2f\u79ef\u548c\u548c\u7d2f\u79ef\u4e58\u6cd5\u3002 \u6709\u610f\u601d\u7684\u662f\u8fd9\u4e2a\u4f8b\u5b50\u5177\u6709\u4e24\u9762\u6027\uff0c\u4e00\u65b9\u9762\u5c55\u793a\u4e86lambda\u548creduce\u5982\u4f55\u4e00\u8d77\u4f7f\u7528\uff0c\u53e6\u4e00\u65b9\u9762\u4e5f\u5f15\u51fa\u4e86\u63a5\u4e0b\u6765\u6211\u60f3\u8bf4\u7684\u91cd\u70b9\uff1alambda\u771f\u7684\u503c\u5f97\u7528\u5417\uff1f\u5230\u5e95\u5e94\u8be5\u600e\u4e48\u7528\uff1f\n <\/div>\n

\u907f\u514d\u8fc7\u5ea6\u4f7f\u7528lambda<\/h2>\n
\n \u901a\u8fc7\u4e0a\u9762\u7684\u4f8b\u5b50\u5927\u5bb6\u5df2\u7ecf\u770b\u5230\u4e86lambda\u7684\u5b9e\u9645\u5e94\u7528\u573a\u666f\uff0c\u4f46\u662f\u8fd9\u91cc\u6211\u60f3\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u6211\u7684\u770b\u6cd5:\u6211\u8ba4\u4e3alambda\u7684\u7f3a\u70b9\u7565\u591a\u4e8e\u4f18\u70b9\uff0c\u5e94\u8be5\u907f\u514d\u8fc7\u5ea6\u4f7f\u7528lambda\u3002\n <\/div>\n
\n \u9996\u5148\u8ba9\u6211\u4eec\u62fflambda\u65b9\u6cd5\u548c\u5e38\u89c4def\u505a\u4e2a\u5bf9\u6bd4\uff0c\u6211\u53d1\u73b0lambda\u548cdef\u7684\u4e3b\u8981\u4e0d\u540c\u70b9\u5982\u4e0b\uff1a\n <\/div>\n

\u53ef\u4ee5\u7acb\u5373\u4f20\u9012\uff08\u65e0\u9700\u53d8\u91cf\uff09<\/span>
\n \u53ea\u9700\u4e00\u884c\u4ee3\u7801\uff0c\u7b80\u6d01\uff08\u672a\u5fc5\u9ad8\u6548\uff09<\/span>
\n \u53ef\u4ee5\u4f1a\u81ea\u52a8\u8fd4\u56de\uff0c\u65e0\u9700return<\/span>
\n lambda\u51fd\u6570\u6ca1\u6709\u51fd\u6570\u540d\u79f0<\/span> <\/p>\n

\n \u6709\u5173\u4f18\u70b9\u5927\u5bb6\u90fd\u53ef\u4ee5\u770b\u5230\uff0c\u6211\u4e3b\u8981\u60f3\u8bf4\u4e00\u4e0b\u5b83\u7684\u7f3a\u70b9\uff0c\u9996\u5148\uff0c
\n \u4ece\u771f\u6b63\u9700\u6c42\u51fa\u53d1\uff0c\u6211\u4eec\u5728\u5927\u591a\u6570\u65f6\u5019\u662f\u4e0d\u9700\u8981lambda\u7684\uff0c\u56e0\u4e3a\u603b\u53ef\u4ee5\u627e\u5230\u66f4\u597d\u7684\u66ff\u4ee3\u65b9\u6cd5\uff0c<\/b>\u73b0\u5728\u6211\u4eec\u4e00\u8d77\u770b\u4e00\u4e0b\u521a\u624dlambda+reduce \u7684\u4f8b\u5b50\uff0c\u6211\u4eec\u7528lambada\u5b9e\u73b0\u7684\u7ed3\u679c\u5982\u4e0b\uff1a\n <\/div>\n
\n
 from <\/span>functools import <\/span>reduce # Only Python 3
<\/span>     numbers = [1,2,3,4]
    result_multiply = reduce((lambda <\/span>x, y: x * y), numbers)
    result_add = reduce((lambda <\/span>x,y: x+y), numbers)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u91cc\u7528lambda\u5e76\u6ca1\u6709\u5b9e\u73b0\u7b80\u5355\u9ad8\u6548\u7684\u76ee\u7684\uff0c\u56e0\u4e3a\u6211\u4eec\u6709\u73b0\u6210\u7684sum\u548cmul\u65b9\u6cd5\u53ef\u4ee5\u7528\uff1a\n <\/div>\n
\n
 from <\/span>functools import <\/span>reduce
from <\/span>operator <\/span>import <\/span>mul
numbers = [1,2,3,4]
result_add = sum(numbers)
result_multiply =reduce(mul,numbers)
print(result_add)
print(result_multiply)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 10
24 <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7ed3\u679c\u662f\u4e00\u6837\u7684\uff0c\u4f46\u662f\u663e\u7136\u7528sum\u548cmul\u7684\u65b9\u6848\u66f4\u52a0\u9ad8\u6548\u3002\u518d\u4e3e\u4e2a\u5e38\u89c1\u7684\u4f8b\u5b50\u8bf4\u660e\uff0c\u5047\u5982\u6211\u4eec\u6709\u4e00\u4e2alist\u5b58\u50a8\u4e86\u5404\u79cd\u989c\u8272\uff0c\u73b0\u5728\u8981\u6c42\u628a\u6bcf\u4e2a\u989c\u8272\u9996\u5b57\u6bcd\u5927\u5199\uff0c\u5982\u679c\u7528lambda\u5199\u51fa\u662f\u8fd9\u6837\uff1a\n <\/div>\n
\n
 colors = ['red'<\/span>,'purple'<\/span>,'green'<\/span>,'blue'<\/span>]
result = map(lambda <\/span>c:c.capitalize<\/span>(),colors)
print(list(result))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 ['Red', 'Purple', 'Green', 'Blue'] <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u770b\u7740\u4f3c\u4e4e\u4e0d\u9519\uff0c\u633a\u7b80\u6d01\u7684\uff0c\u4f46\u662f\u6211\u4eec\u6709\u66f4\u597d\u7684\u65b9\u6cd5\uff1a\n <\/div>\n
\n
 colors = ['red'<\/span>,'purple'<\/span>,'green'<\/span>,'blue'<\/span>]
result = [c.capitalize<\/span>() for <\/span><\/span>c in <\/span>colors]
print(result)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 ['Red', 'Purple', 'Green', 'Blue'] <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7528sorted\u8fd8\u80fd\u5904\u7406\u9996\u5b57\u6bcd\u4e0d\u89c4\u8303\u7684\u60c5\u51b5\uff0c\u8fde\u6392\u5e8f\u90fd\u7701\u4e86\uff1a\n <\/div>\n
\n
 colors = ['Red'<\/span>,'purple'<\/span>,'Green'<\/span>,'blue'<\/span>]
print(sorted(colors,key=str.capitalize))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd0\u884c\u7ed3\u679c\uff1a\n <\/div>\n
\n
 ['Red', 'Purple', 'Green', 'Blue'] <\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd8\u6709\u4e00\u4e2a\u4e3b\u8981\u539f\u56e0\u5c31\u662f: lambda\u51fd\u6570\u6ca1\u6709\u51fd\u6570\u540d\u79f0\u3002\u6240\u4ee5\u5728\u4ee3\u7801\u4ea4\u63a5\uff0c\u9879\u76ee\u79fb\u690d\u7684\u573a\u666f\u4e2d\u4f1a\u7ed9\u56e2\u961f\u5e26\u6765\u5f88\u591a\u56f0\u96be\uff0c\u591a\u5199\u4e2a\u51fd\u6570add_one()\u6ca1\u4ec0\u4e48\u574f\u5904\uff0c\u56e0\u4e3a\u5927\u5bb6\u90fd\u5f88\u5bb9\u6613\u7406\u89e3\uff0c\u77e5\u9053\u5b83\u662f\u6267\u884c+1\u7684\u529f\u80fd\uff0c\u4f46\u662f\u5982\u679c\u56e2\u961f\u91cc\u4f60\u5728\u81ea\u5df1\u8d1f\u8d23\u7684\u6a21\u5757\u4f7f\u7528\u4e86\u5f88\u591alambda\uff0c\u4f1a\u7ed9\u5176\u4ed6\u4eba\u7406\u89e3\u5e26\u6765\u5f88\u591a\u9ebb\u70e6\u3002\n <\/div>\n

\u9002\u5408lambda\u7684\u573a\u666f<\/h2>\n
\n \u8bdd\u53c8\u8bf4\u56de\u6765\uff0c\u5b58\u5728\u5373\u5408\u7406\uff0c\u90a3\u4e48\u771f\u6b63\u9700\u8981\u6211\u4eec\u4f7f\u7528lambda\u7684\u662f\u54ea\u4e9b\u573a\u666f\u5462\uff1a\n <\/div>\n

\u9700\u8981\u5904\u7406\u7684\u65b9\u6cd5\u662f\u5f88\u7b80\u5355\u7684(+1\uff0c\u5b57\u7b26\u4e32\u62fc\u63a5\u7b49),\u8be5\u51fd\u6570\u4e0d\u503c\u5f97\u62e5\u6709\u4e00\u4e2a\u540d\u5b57\u3002<\/span>
\n \u4f7f\u7528lambda\u8868\u8fbe\u5f0f\uff0c\u4f1a\u6bd4\u6211\u4eec\u80fd\u60f3\u5230\u7684\u51fd\u6570\u540d\u79f0\u66f4\u5bb9\u6613\u7406\u89e3\u3002<\/span>
\n \u9664\u4e86lambda\uff0c\u6ca1\u6709\u4efb\u4f55python\u63d0\u4f9b\u7684\u51fd\u6570\u53ef\u4ee5\u5b9e\u73b0\u76ee\u3002<\/span>
\n \u56e2\u961f\u4e2d\u6240\u6709\u6210\u5458\u90fd\u719f\u7ec3\u638c\u63e1\u4e86lambda\u8868\u8fbe\u5f0f\uff0c\u5e76\u4e14\u7eb3\u5165\u4e86\u56e2\u961f\u7684\u5f00\u53d1\u89c4\u8303\u3002<\/span> <\/p>\n

\n \u4efb\u4f55\u4e8b\u60c5\u90fd\u5177\u6709\u4e24\u9762\u6027\uff0c\u6211\u4eec\u5728\u4f7f\u7528lambda\u4e4b\u524d\u5e94\u8be5\u5148\u601d\u8003\u7528lambda\u8868\u8fbe\u5f0f\u662f\u5426\u662f\u6700\u7b80\u6d01\u7684\u4ee3\u7801\u3002\n <\/div>\n

<\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Python lambdazh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[126],"tags":[],"class_list":["post-1059","post","type-post","status-publish","format-standard","hentry","category-python3"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1059"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1059"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1059\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}