[Tutor] Multiple Simultaneous Loops

Alan G alan.gauld at freenet.co.uk
Thu Sep 15 19:22:43 CEST 2005


> for f, x in bunch_of_files, range(z):

...
> Or maybe can I access the number of times the 
> loop has run?  

I think thats what enumerate does...


>>> for x,y in enumerate([1,3,5]):
...   print x,y
...
0 1
1 3
2 5
>>>


Yep, looks like what you need.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld






More information about the Tutor mailing list