Skip to content

Instantly share code, notes, and snippets.

@poros
Created October 4, 2015 15:02
Show Gist options
  • Save poros/0bbd38ade29dd95e64a2 to your computer and use it in GitHub Desktop.
Save poros/0bbd38ade29dd95e64a2 to your computer and use it in GitHub Desktop.
Loop over two collections
n = min(len(names), len(colors))
for i in range(n):
print names[i], colors[i]
for names, color in zip(names, colors):
print name, color
#collections.izip is the iterator version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment