Find index when you're inside a loop
alist = [5, 6 , 7, 8]
for i, value in enumerate(alist):
print i, ': ', value
-> 0: 5
-> 1: 6
-> 2: 7
-> 3: 8
Written by Mohammad Taleb
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#