Discuss / Python / 素数的例子可否在filter里直接放入lambda?

素数的例子可否在filter里直接放入lambda?

Topic source

Robert_LoL

#1 Created at ... [Delete] [Delete and Lock User]
it = filter(lambda x: x % n != 0, it)

改成这样似乎不行。

编辑同学

#2 Created at ... [Delete] [Delete and Lock User]

我试了下,没什么问题。这样也可以


  • 1

Reply