Skip to content

Instantly share code, notes, and snippets.

@SZanlongo
Created September 18, 2014 02:00
Show Gist options
  • Save SZanlongo/82db11024ee730ca4def to your computer and use it in GitHub Desktop.
Save SZanlongo/82db11024ee730ca4def to your computer and use it in GitHub Desktop.
Enumerate items in list
# https://stackoverflow.com/questions/691946/short-and-useful-python-snippets
# Allows you to have access to the indexes of the elements within a for loop
l = ['a', 'b', 'c', 'd', 'e', 'f']
for (index, value) in enumerate(l):
print index, value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment