[Tutor] Multiple Simultaneous Loops

Pujo Aji ajikoe at gmail.com
Thu Sep 15 11:16:28 CEST 2005

you have two list with the same size
L1 = [1,2,3]
L2 = [11,22,33]
 you can zip the L1 and L2 into L
L = zip(L1,L2) # L = [(1,11),(2,22),(3,33)] 
 then you can process:
for x in L:
 I'm not so sure about your problem but
If you want to do something parallel processing then you should go to 
threading or pyro.

On 9/15/05, Ed Singleton <singletoned at gmail.com> wrote: 
> I roughly want to be able to do:
> for f, x in bunch_of_files, range(z):
> so that x iterates through my files, and y iterates through something 
> else.
> Is this something I can do?
> If so, what would be the best way to create a range of indeterminate 
> length?
> If not, is there a nice way I can do it, rather than than incrementing
> a variable (x = x + 1) every loop?
> Or maybe can I access the number of times the loop has run? ('x = x +
> 1' is so common there must be some more attractive shortcut).
> So far in learning Python I've founbd that when I feel you should be
> able to do something, then you can. This seems a pretty intuitive
> thing to want to do, so I'm sure it must be possible, but I can't find
> anything on it.
> Many thanks
> Ed
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050915/6cbf6540/attachment-0001.html

More information about the Tutor mailing list