How to get filter to work with a lambda taking multiple arguments?

后端 未结 9 1074
闹比i
闹比i 2020-12-08 22:11

Using Python, am finding it difficult to get filter() to work with lambda for cases where more than 1 argument needs to be passed as is the case in the following snippet:

9条回答
  •  感动是毒
    2020-12-08 22:33

    I hope you are aware of?

    >>> max([1, 4, 8])
    8
    

    filter() takes a single argument. In your case, it will take 1. Then 4. Then 8.

提交回复
热议问题