Created
September 18, 2014 02:00
-
-
Save SZanlongo/82db11024ee730ca4def to your computer and use it in GitHub Desktop.
Enumerate items in list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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