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

后端 未结 9 1073
闹比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:32

    The function passed to filter() only gets a single argument passed to it, which is the current element in the iterable being iterated.. If you need something fancier than that then filter() won't do.

提交回复
热议问题