描述
map() 会根据提供的函数对指定序列做映射。
第一个参数 function 以参数序列中的每一个元素调用 function 函数,返回包含每次 function 函数返回值的新列表。
语法
map(function, iterable, …)
function – 函数
iterable – 一个或多个序列
返回值
Python 2.x 返回***列表***。(print变量之后可以被打印出来)
Python 3.x 返回***迭代器***。(print变量之后不能打印出来,但是可以使用for循环单个打印)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/db5a669cc1b6f0d924b45ed54d843b05.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/cf921a6da0b8399fadefa2f7ad2836fa.png)
参考网站:
http://www.runoob.com/python/python-func-map.html