Python 并行遍历zip()函数使用方法(更新日期:2017-07-11)
来源:互联网 发布:js代码在线翻译 编辑:程序博客网 时间:2024/06/15 04:38
三种写法,结果都一样:
1)
>>>for x,y in zip([1,2,3],[4,5,6]):... print x,y...1 42 53 6
2)
>>>a=[1,2,3]>>>b=[4,5,6]>>>for x,y in zip(a,b):... print x,y...1 42 53 6
3)
>>>a=[1,2,3]>>>b=[4,5,6]>>>for (x,y) in zip(a,b):... print x,y...1 4 2 53 6
稍微修改一下代码:
>>>for y,x in zip([1,2,3],[4,5,6]):... print x,y4 15 26 3
结论:x和y有顺序之分。
参考资料:
Python 并行遍历zip()函数使用方法
阅读全文
0 0
- Python 并行遍历zip()函数使用方法(更新日期:2017-07-11)
- python zip()并行遍历
- python中zip函数的使用方法
- Python:zip()函数
- Python zip()使用方法
- Python基础、函数及其相关函数库(Numpy、TensorFlow)常用函数集锦(更新中,更新日期:2017-08-03)
- python的zip()函数
- python的zip()函数
- python之zip()函数
- python zip函数同时遍历两个数组和构造字典
- python zip函数说明
- Python的zip函数
- Python的zip函数
- Python的zip函数
- python zip函数
- Python的zip函数
- Python的zip函数
- python的zip函数
- 排序算法(二)——选择排序及改进
- 在TensorFlow框架下实现DBN网络
- USB四种传输模式
- Android 获取手机的厂商、型号、Android系统版本号、IMEI、当前系统语言等工具类
- POJ-3984 迷宫问题
- Python 并行遍历zip()函数使用方法(更新日期:2017-07-11)
- f-stack dpdk bond 功能
- git学习指南
- Echarts多张图片插入word解决方案
- 如何优雅地使用Sublime Text3
- A+B problem(0)
- 排序算法(三)——插入排序及改进
- 白天谋生存,晚上谋发展
- bionic