python 内置函数 map、 reduce 、filter
来源:互联网 发布:58同城网招聘淘宝客服 编辑:程序博客网 时间:2024/05/22 00:43
map:
map(func,a):根据func的功能,逐个处理list a 中的元素。
例如:
import numpy <span style="white-space:pre"></span> def func(a,b): #如果a<b 则a=0 if a>b: return a else : return 0a=numpy.array([2,3,5,42,23,2,0,34,5,6])b=numpy.array(range(0,20,2))c=map(func,a,b)<span style="white-space:pre"></span> #<span style="white-space:pre"></span> print a<span style="white-space:pre"></span>,b,c<span style="font-family: Arial, Helvetica, sans-serif;"></span><span style="font-family: Arial, Helvetica, sans-serif;"></span> <span style="font-family: Arial, Helvetica, sans-serif;">output:</span><span style="font-family: Arial, Helvetica, sans-serif;"></span> <span style="font-family: Arial, Helvetica, sans-serif;"></span> <span style="font-family: Arial, Helvetica, sans-serif;">[ 2 3 5 42 23 2 0 34 5 6][ 0 2 4 6 8 10 12 14 16 18][2, 3, 5, 42, 23, 0, 0, 34, 0, 0]</span>可以看到输出的结果是利用func 逐个处理a,b中的元素。<span style="font-family: Arial, Helvetica, sans-serif;"></span><span style="font-family: Arial, Helvetica, sans-serif;"></span><span style="font-family: Arial, Helvetica, sans-serif;"></span>
0 0
- python内置函数map/reduce/filter
- python内置函数map/reduce/filter
- python map ,reduce filter内置函数使用说明
- python 内置函数map/filter/reduce
- python 内置函数 map、 reduce 、filter
- python 内置函数filter, lambda, map, reduce
- Python 内置函数 lambda、filter、map、reduce
- python内置函数map/reduce/filter
- Python【map、reduce、filter】内置函数使用说明
- python内置函数lambda、filter、map、reduce
- map、reduce、filter内置函数
- python几个内置函数之-filter,map,reduce
- python 中的 filter, lambda, map, reduce 内置函数
- python中的三个内置函数map,reduce,filter
- [Python] 内置序列函数之 filter, map, reduce, zip
- Python常用内置函数介绍【filter,map,reduce,apply,zip】
- python一些内置函数——filter、map、reduce
- python 中的 filter, lambda, map, reduce 内置函数
- LeetCode Same Tree
- QT中进行debug输出和使用cout cin等的问题
- Sicily 题目分类
- 隐含语义索引(Latent Semantic Indexing )
- PHP验证图片制作
- python 内置函数 map、 reduce 、filter
- linux awk命令详解
- 阿里巴巴java研发成功笔面试总结
- OpenVPN优化之-巨型帧
- 归并排序
- poj 3067
- php的页面静态化技术 ob(out_put buffering)
- awk的类sql数据处理
- C语言实现strlen()4种方法和strcat()3种方法