Is there a way to get the loop counter of a for loop without using a range?
If I have a for loop using a range like this:
for x in range(10):
then it is just x to get the score. But tell me I have a for loop using a list:
layer = [somedata,someotherdata...etc]
for row in layer:
print #the number the loop is on
Is there a way to do this other than specifying an integer variable count and incrementing it each run like this?
layer = [somedata]
count = 0
for row in layer:
print count
count += 1
+3
source to share