您的位置: 首页 > 文章 > filter过滤 filter过滤 分类: 文章 • 2024-06-16 23:14:46 filter 过滤 过滤数组中数字为0的 list_x = [1,0,2,0,3,0,4] r = filter(lambda x: True if x!=0 else False, list_x) print(list®) filter的特点: lambda表达式必须有真和假