a = range(3)
b = range(3)
[ (x, y) for x, y in zip(a, b) ]

结果:

 [ (0,0), (1,1), (2,2) ]

当然,如上可以推广到多个列表。

Python 同时for遍历多个列表的更多相关文章

  1. python 如何在一个for循环中遍历两个列表

    是我在看<笨方法学python>过程中发现有一行代码看不懂--" for sentence in snippet, phrase:",所以研究了半天,感觉挺有收获的.所 ...

  2. python创建与遍历List二维列表

    python创建与遍历List二维列表 觉得有用的话,欢迎一起讨论相互学习~Follow Me python 创建List二维列表 lists = [[] for i in range(3)] # 创 ...

  3. python 三种遍历列表里面序号和值的方法

    list = ['html', 'js', 'css', 'python'] # 方法1 # 遍历列表方法1:' for i in list: print("序号:%s 值:%s" ...

  4. python遍历多个列表生成列表或字典

    key=['a','b','c','d'] value=[1,2,3,4] mydict=dict(zip(key,value)) print mydict 输出结果: {'a': 1, 'c': 3 ...

  5. 【python】实践中的总结——列表『持续更新中』

    2016-04-03 21:02:50 python list的遍历 list[a::b]   #从list[a] 开始,每b个得到一个元组,返回新的list 举个例子: >>> l ...

  6. 第五篇:python基础之循环结构以及列表

    python基础之循环结构以及列表   python基础之编译器选择,循环结构,列表 本节内容 python IDE的选择 字符串的格式化输出 数据类型 循环结构 列表 简单购物车的编写 1.pyth ...

  7. python入门学习:3.操作列表

    python入门学习:3.操作列表 关键点:列表 3.1 遍历整个列表3.2 创建数值列表3.3 使用列表3.4 元组 3.1 遍历整个列表   循环这种概念很重要,因为它是计算机自动完成重复工作的常 ...

  8. 【转】python 三种遍历list的方法

    [转]python 三种遍历list的方法 #!/usr/bin/env python # -*- coding: utf-8 -*- if __name__ == '__main__': list ...

  9. Python学习系列(四)(列表及其函数)

    Python学习系列(四)(列表及其函数) Python学习系列(一)(基础入门) Python学习系列(二)(基础知识) Python学习系列(三)(字符串) 一.基本概念 1,列表是什么?     ...

随机推荐

  1. 读书笔记 (二) ———Fundamentals of Multiagent Systems with NetLogo Examples by Prof. Jose M Vidal

    chapter 2 分布式约束1 分布式约束满足 1.1 过滤算法 1.2 基于归结的调和算法 consistency 1.3 异步回溯 1.4 异步弱承诺? 1.5 分布式突破?2 分布式受限优化 ...

  2. Extjs4.2——Panel

    一.Panel的border属性: 示例: Ext.create('Ext.panel.Panel', { title: 'Hello', width: 200, height:100, border ...

  3. 解决VS如何同时打开两个工程(xp和win7)

    http://www.360doc.com/content/11/1020/00/7891073_157586269.shtml

  4. 团体程序设计天梯赛-练习集L2-004. 这是二叉搜索树吗

    L2-004. 这是二叉搜索树吗? 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 一棵二叉搜索树可被递归地定义为具有下列性质的 ...

  5. HDU1412

    大水题.. 求集合的并 /* */ #include<algorithm> #include<iostream> #include<string.h> #inclu ...

  6. http://jingyan.baidu.com/article/a3761b2b66fe141577f9aa51.html

    http://jingyan.baidu.com/article/a3761b2b66fe141577f9aa51.html

  7. 李洪强iOS开发之 - WebViewJavascriptBridge

    李洪强iOS开发之 - WebViewJavascriptBridge 01 - JS端:   02 - iOS端 01 遵守代理协议 02 申明属性 03 开启日志 04 给哪个webview建立J ...

  8. [topcoder]ZigZag

    http://community.topcoder.com/stat?c=problem_statement&pm=1259&rd=4493 动态规划题.如果不用DP,暴力的应当在2^ ...

  9. ANDROID_MARS学习笔记_S01_011ProgressBar

    文档是这样来设置样式 <ProgressBar android:layout_width="wrap_content" android:layout_height=" ...

  10. ZOJ1586——QS Network(最小生成树)

    QS Network DescriptionIn the planet w-503 of galaxy cgb, there is a kind of intelligent creature nam ...