filter(function,iterable)
用来过滤可迭代对象

如果提供过滤条件的函数为None,则可迭代对象中为False的元素将被过滤掉。

例如:

>>> a = [1,'','ok',True,0,False,]
>>> b = filter(None,a)
>>> b
<filter object at 0x000000EE96242160>
>>> list(b)
[1, 'ok', True]

 

相关文章:

  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-07-30
  • 2021-10-25
  • 2022-12-23
猜你喜欢
  • 2021-11-24
  • 2022-02-01
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
相关资源
相似解决方案