Python Filter()用法

filter(function, iterable):根据判断函数,过滤掉相应的数据

 python2与python3中filter的区别:

    python2中filter()返回的是list对象,可直接使用。

      

    python3中filter()返回的是filter对象,不可直接使用,可用list转换

        

猜你喜欢

转载自blog.csdn.net/fm345689/article/details/84893419