Python - enumerate
enumerate(iterable, start=0)
Python3: numerate
Instead of doing:
list = ["a", "b", "c"]
i = 0
for item in list:
print i, item
i += 1
Do This:
for i, item in enumerate(list):
print i, item
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.