[Tutor] getting iteration level

David Bear david.bear at asu.edu
Thu Sep 6 19:40:34 CEST 2007


Lets say I have a list object that I iterate over like this:

for item in myList:
   process(item)

During execution of the for loop something happens and I want to know how
many items have be iterated over, how do I find out? Without resorting to
some counter inside the loop, is there some python object I can ask?


--
David Bear
College of Public Programs at Arizona State University



More information about the Tutor mailing list