Python函数-map()
2017-05-02 21:43
381 查看
map()函数 map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回。
如下:
def f(x): return x*x print map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9])
输出结果: [1, 4, 9, 10, 25, 36, 49, 64, 81]
相关文章推荐
- Python学习 Day 5 高阶函数 map/reduce filter sorter 返回函数 匿名函数 装饰器 偏函数
- python函数—filter,map,keys
- Python中的map()函数和reduce()函数的用法
- 【廖雪峰 python教程 课后题改编】利用map()函数,把用户输入的不规范的英文名字,变为首字母大写,其他小写的规范名字
- [Python] 函数lambda(), filter(), map(), reduce()
- python中map()函数和reduce()函数的使用
- Python 函数 —— map(), reduce()
- python map函数用法
- python的map()函数
- python map()函数 和 reduce()函数
- Python的map函数实现代码
- python 中的map any all 函数
- python中map、any、all函数用法分析
- python几个重要的函数(lambda,filter,reduce,map,zip)
- [Python] 函数lambda(), filter(), map(), reduce()
- python的lambda表达式 内建函数filter map reduce
- Python入门 第四天(函数式编程、map、reduce、filter、排序函数、函数返回函数、闭包、匿名函数lambda)
- python中map()和reduce()函数的区别
- python 里map()函数想到的外国人为什么要这么定义函数
- python3下使用map()函数返回<map object at 0x00000000038327F0>导致不能直接使用的解决办法