复制代码
1
2
3
4
5
6i = [1,None,"kll"] test = filter(lambda x: True if x else False, i ) for k in test: print(k)
这种方式比较简洁优雅
最后
以上就是碧蓝电脑最近收集整理的关于Python 使用filter过滤列表的全部内容,更多相关Python内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复