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

后端 未结 9 1075
闹比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条回答
  •  猫巷女王i
    2020-12-08 22:51

    I think all others didn't get the point. the error message is for lambda function not for the filter. You should rather call it this way:

    filter(max_validation, *sequence1)
    

    add a star on the list transform it into three arguments, then it will work.

提交回复
热议问题