Python 学习过程
来源:互联网 发布:热力系统计算软件 编辑:程序博客网 时间:2024/06/05 00:57
函数
Map Reduce 用法
map()需要两个参数,一个是函数,一个是Iterable, map将传入的函数依次作用到传入的Iterabe,并把结果作为新的Iterator返回。
如下:
>>> def f(x):... return x * x...>>> r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9])>>> list(r)[1, 4, 9, 16, 25, 36, 49, 64, 81]
Recuce用法
再看reduce的用法。reduce把一个函数作用在一个序列[x1, x2, x3, …]上,这个函数必须接收两个参数,reduce把结果继续和序列的下一个元素做累积计算,其效果就是:
reduce(f, [x1, x2, x3, x4]) = f(f(f(x1, x2), x3), x4)
阅读全文
0 0
- python-django 学习过程
- Python学习过程1
- python学习 过程
- python学习过程
- python爬虫学习过程
- python学习过程随笔
- Python 学习过程
- python学习过程
- Python学习过程(一)
- python学习过程随手记
- python challenge 7学习过程
- Python 机器学习过程小结
- python机器学习简易过程
- Python学习笔记--变量赋值过程
- python 学习过程中的一点反思
- 多线程学习过程记录(python)
- Python学习笔记四:过程控制
- 苦逼的Python爬虫学习过程
- 内存泄露分析OutOfMemoryError-(Memory Analyzer Tool,MAT)
- 2017-8-21到2017-11-21
- Springboot-HelloWorld
- CString、String、Char*相互转换
- 糖油拌饭
- Python 学习过程
- Nginx访问PHP文件的File not found错误处理,两种情况
- 卷积神经网络(二)
- Cocoscreator-cc.Node
- 第一章 对象导论1
- Linux】CentOS安装solr 4.10.3
- 关于HTTP_RAW_POST_DATA
- OpenCV学习之路(二)-图片特征提取、图片翻转
- java.lang.OutOfMemoryError: PermGen space及其解决方法