On Sat, Nov 28, 2009 at 6:59 AM, Dave Angel <da...@ieee.org> wrote: > > And if the lists are large, use itertools.izip() which works the same, but > produces an iterator. > > Note that if the lists are not the same length, I think it stops when the > shorter one ends. >
But you can use izip_longest: import itertools list1 = [1,2,3,4] list2 = [1,2] lIn [32]: for x, y in itertools.izip_longest(list1, list2): ....: print x,y ....: ....: 1 1 2 2 3 None 4 None HTH, Wayne -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn’t. - Primo Levi
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor