|
|

楼主 |
发表于 2020-2-7 22:16:08
|
显示全部楼层
list(filter(lambda x,y:( [x,y] if y==x+1 else 0),[1,2]))
Traceback (most recent call last):
File "<pyshell#138>", line 1, in <module>
list(filter(lambda x,y:( [x,y] if y==x+1 else 0),[1,2]))
TypeError: <lambda>() missing 1 required positional argument: 'y'
\\
list(map(lambda x,y:[x,y],filter(lambda x,y:( 1 if y==x+1 else 0),(1,2))))
\\
list( map(lambda x,y:[x,y],filter(lambda x,y: 1 if y==x+1 else 0,(1,2))))
Traceback (most recent call last):
File "<pyshell#117>", line 1, in <module>
list( map(lambda x,y:[x,y],filter(lambda x,y: 1 if y==x+1 else 0,(1,2))))
TypeError: <lambda>() missing 1 required positional argument: 'y' |
|