Skip to content

Instantly share code, notes, and snippets.

@dfletcher
Created March 2, 2012 16:46
Show Gist options
  • Save dfletcher/1959578 to your computer and use it in GitHub Desktop.
Save dfletcher/1959578 to your computer and use it in GitHub Desktop.
a = [1, 2, 3, 4]
for x in range(0, len(a), 2):
pair = a[x:x+2]
print(pair)
... or individually ...
for x in range(0, len(a), 2):
print(str(a[x]) + ', ' + str(a[x+1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment