map: 最大长度输出;

zip: 最短输出;

third: 有序排列;

a = ['a1', 'a2', 'a3']
b = ['b1', 'b2'] print "Map:"
for x, y in map(None, a, b):
print x, y # will iterate 2 times,
# the third value of a will not be used
print "Zip:"
for x, y in zip(a, b):
print "{0}, {1}".format(x, y) # will iterate 6 times,
# it will iterate over each b, for each a
# producing a slightly different outpu
print "List:"
for x, y in [(x,y) for x in a for y in b]:
print x, y
================= RESTART: /Users/vivi/Documents/multlist.py =================
Map:
a1 b1
a2 b2
a3 None
Zip:
a1, b1
a2, b2
List:
a1 b1
a1 b2
a2 b1
a2 b2
a3 b1
a3 b2

looping through multiple lists的更多相关文章

  1. Displaying SharePoint Lists or Libraries in other sites 显示其他站点的List

    Child objects within SharePoint, like a list in a Site, share an inherent connection with that Paren ...

  2. notes: the architecture of GDB

    1. gdb structure at the largest scale,GDB can be said to have two sides to it:1. The "symbol si ...

  3. MatterTrack Route Of Network Traffic :: Matter

    Python 1.1 基础 while语句 字符串边缘填充 列出文件夹中的指定文件类型 All Combinations For A List Of Objects Apply Operations ...

  4. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q45-Q48)

    Question 45 You are designing a branding strategy for a customer with a new SharePoint 2010 server f ...

  5. Meet Python: little notes 2

    From this blog I will turn to Markdown for original writing. Source: http://www.liaoxuefeng.com/ ♥ l ...

  6. Google上的Cookie Matching

    Cookie Matching This guide explains how the Cookie Matching Service enables you to make more effecti ...

  7. Scala中Zip相关的函数

    在Scala中存在好几个Zip相关的函数,比如zip,zipAll,zipped 以及zipWithIndex等等.我们在代码中也经常看到这样的函数,这篇文章主要介绍一下这些函数的区别以及使用. 1. ...

  8. underscore.js源码解析【数组】

    // Array Functions // --------------- // Get the first element of an array. Passing **n** will retur ...

  9. Underscore.js(1.9.1) 封装库

    // Underscore.js 1.9.1// http://underscorejs.org// (c) 2009-2018 Jeremy Ashkenas, DocumentCloud and ...

随机推荐

  1. 笔记:VSCODE 在 WSL 开发时不显示代码差异问题

    笔记:VSCODE 在 WSL 开发时不显示代码差异问题 这个好像和 VSCODE 关系不大,主要是因为 WSL 里使用了软链接接,导致无法显示差异. 因为毕竟是软链接,所以在系统文件中会导致无法识别 ...

  2. 2019-9-18-WPF-笔刷绑定不上可能的原因

    title author date CreateTime categories WPF 笔刷绑定不上可能的原因 lindexi 2019-09-18 09:46:14 +0800 2019-9-18 ...

  3. SDUT-3441_数据结构实验之二叉树二:遍历二叉树

    数据结构实验之二叉树二:遍历二叉树 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 已知二叉树的一个按先序遍历输入的字符 ...

  4. 无人驾驶——对frenet坐标的理解

    好的确定车和路之间的关系,我们通常将车辆的在大地坐标坐标转化为车辆和道路之间的frenet坐标. 可能有人会疑问为什么转换后就方便了呢?我们来看一个例子. 在大地坐标下: 无人车首先要知道红色车的位置 ...

  5. HZOJ 光

    一道大模拟,打的我要吐了. 先说一下60%暴力吧,其实模拟光的路线即可,最好还是把边界设为障碍,这样就不用判边界了.最后输出n*m可以骗到10分. 注意不要把n和m弄混(愁死我了). #include ...

  6. 微博第三方登录时,域名使用错误报错, Laravel \ Socialite \ Two \ InvalidStateException No message

    使用微博第三方登录时,报错 Laravel \ Socialite \ Two \ InvalidStateException No message Laravel \Socialite \Two \ ...

  7. uni-app原生导航栏使用iconfont图标

    在 iconfont 将图标下载之后,会有一个 .ttf 后缀的文件 把它放进 static 文件夹里 然后打开在iconfont下载的  demo_index.html  文件 选择 Unicode ...

  8. 开源中国 2014 最受关注开源软件排行榜 TOP 50

    开源中国 2014 最受关注开源软件排行榜 TOP 50 开源中国 2014 年最受关注软件排行榜 TOP 50 正式出炉!2014 年结束了,我们来了解一下过去一年里开源中国最受欢迎的 50 款软件 ...

  9. vue tab栏缓存解决跳转页面后返回的状态保持

    <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8& ...

  10. Python __call__详解

    可以调用的对象 关于 __call__ 方法,不得不先提到一个概念,就是可调用对象(callable),我们平时自定义的函数.内置函数和类都属于可调用对象,但凡是可以把一对括号()应用到某个对象身上都 ...