参考: https://www.runoob.com/python/python-func-filter.html

filter() 函数  判断数组里面的 数据 是否符合 要求,符合就加入数组

 

 有可能输出有问题 最后输出改成 print( list(newlist) )

 

其他例子(判断变量是否为空):

a=3
b=4

print (list(filter(lambda X: True if X else False, [a,b,C])))

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2021-11-17
  • 2021-11-17
  • 2022-02-13
猜你喜欢
  • 2021-09-28
  • 2022-12-24
  • 2022-12-24
  • 2021-12-02
  • 2021-11-19
相关资源
相似解决方案