Re: [Tutor] is it possible to traverse two lists simulatenously using python

2009-04-30 Thread Tim Johnson
On Wednesday 29 April 2009, mobiledream...@gmail.com wrote: > Python > for i,j in topgirls, richgirls: > print i,j > > > Cheetah > #for $i,$j in $topgirls, $richgirls$i, $j > #end for > This doesnt work Hello - Please do not send email to the python ML via "undisclosed recipients". It's really

Re: [Tutor] is it possible to traverse two lists simulatenously using python

2009-04-30 Thread Lie Ryan
Michiel Overtoom wrote: Kent Johnson wrote: Use zip() or itertools.izip(): And when the sequences are of unequal length: On python3.x, use itertools.zip_longest() ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tut

Re: [Tutor] is it possible to traverse two lists simulatenously using python

2009-04-30 Thread Michiel Overtoom
Kent Johnson wrote: Use zip() or itertools.izip(): And when the sequences are of unequal length: topgirls=["Ann","Mary","Casey","Zoe"] richgirls=["Britt","Susan","Alice"] print "\nUsing zip()" for i,j in zip(topgirls,richgirls): print i,j print "\nUsing map()" for i,j in map(None,topgir

Re: [Tutor] is it possible to traverse two lists simulatenously using python

2009-04-30 Thread Kent Johnson
On Thu, Apr 30, 2009 at 2:31 AM, wrote: > Python > for i,j in topgirls, richgirls: >     print i,j Use zip() or itertools.izip(): for i, j in zip(topgirls, richgirls): print i, j Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/m