Skip to content

Instantly share code, notes, and snippets.

@renzon
Created May 21, 2014 22:35
Show Gist options
  • Select an option

  • Save renzon/05a675ad7b895aee77cf to your computer and use it in GitHub Desktop.

Select an option

Save renzon/05a675ad7b895aee77cf to your computer and use it in GitHub Desktop.
from itertools import izip
lista=range(5)
for elemento, proximo_elemento in izip(lista[:-1],lista[1:]):
print elemento,proximo_elemento
# Resultado
# 0 1
# 1 2
# 2 3
# 3 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment