python map和reduce的用法
来源:互联网 发布:部落冲突石头升级数据 编辑:程序博客网 时间:2024/03/29 18:56
>>> L1 = ['a', 'b', 'c']>>> L2 = [1, 2, 3]>>> zip(L1, L2)[('a', 1), ('b', 2), ('c', 3)]>>> map(L1, L2)Traceback (most recent call last): File "", line 1, in ?TypeError: 'list' object is not callable>>> map(None, L1, L2)[('a', 1), ('b', 2), ('c', 3)]>>> dict(zip(L1, L2)){'a': 1, 'c': 3, 'b': 2}>>> dict(map(None, L1, L2)){'a': 1, 'c': 3, 'b': 2}>>> L3 = []>>> zip(L1, L3)[]>>> map(L1, L3)[]>>> map(None, L1, L3)[('a', None), ('b', None), ('c', None)]>>> dict(zip(L1, L3)){}>>> dict(map(None, L1, L3)){'a': None, 'c': None, 'b': None}>>> def fun(A, B):... if B == None: B = ''... return A, B...map(fun, L1, L2)[('a', 1), ('b', 2), ('c', 3)>>> map(fun, L1, L3)[('a', ''), ('b', ''), ('c', '')]>>> dict(map(fun, L1, L3)){'a': '', 'c': '', 'b': ''}
- python map和reduce的用法
- python map和reduce的用法
- python map和reduce的用法
- python map和reduce的用法
- Python 中 map和reduce 的用法
- Python中的map()函数和reduce()函数的用法
- Python中的map()函数和reduce()函数的用法
- python 的map,reduce,filter的用法
- python的map,reduce,filter用法举例
- python filter/map/reduce的用法
- map&reduce的用法
- python的reduce函数和map函数
- python的map和reduce函数
- python 学习--map 和 reduce的使用
- python之map和reduce的区别
- python中map和reduce的应用
- python的map,reduce和zip
- python map及reduce用法
- 那些伤感的记忆
- Shell简单全备mysql脚本案例
- android Theme level 11 使用总结
- 解决 WIN7消息队列安装错误
- Linux 用户认证(crypt方式)
- python map和reduce的用法
- ALV细节
- Android开发之Handler详解
- 复杂的C运行时库
- dwr无刷新分页
- 一道笔试题的思考(二)
- OpenScales 学习和介绍——地图是如何组成的
- django官方文档——模型字段关系参考
- NSTimer深入研究