zip函数的使用
来源:互联网 发布:js图片无缝滚动代码 编辑:程序博客网 时间:2024/06/05 20:06
x = [1, 2, 3]y = [4, 5, 6]z = [7, 8, 9]xyz = zip(x, y, z)#xyz = [(1, 4, 7), (2, 5, 8), (3, 6, 9)] 将3个列表中相同索引位置的元素按照顺序生成元组构成列表abc = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]xyz = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]print zip(*abc)print zip(*xyz)# *在调用函数的时候相当于把参数解压, 传给定义函数时候的*arg# zip(*[[1, 2, 3], [4, 5, 6], [7, 8, 9]])等价于# zip([1, 2, 3], [4, 5, 6], [7, 8, 9])
阅读全文
0 0
- zip函数的使用
- python中zip函数的使用
- python zip函数使用
- python zip() 函数使用
- Python的zip函数
- Python的zip函数
- Python的zip函数
- Python的zip函数
- Python的zip函数
- python的zip函数
- Python的zip函数
- Python的zip函数
- Python的zip函数
- Python 的zip函数
- Python的zip函数
- python 的 zip 函数
- python的zip函数
- Python的zip函数
- centos7/redhat7更改网卡名称为eth0
- Mac开发必备工具(三)—— Fish shell
- 【PAT】【Advanced Level】1101. Quick Sort (25)
- activiti学习--14:用户角色组
- STM32f103zet6,综合大实验。
- zip函数的使用
- Android---多线程
- Laravel 引入第三方类库及自定义函数
- poj2096 Collecting Bugs
- 我的博客即将入驻“云栖社区”,诚邀技术同仁一同入驻。
- 开博了
- oracle去重
- 解决 spring mvc 返回ModelAndView设置viewName无效
- 【Algorithm】 重叠部分面积计算