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,topgirls,richgirls):
    print i,j


--
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Valloppillil
http://www.catb.org/~esr/halloween/halloween4.html
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to