Hi, I'm trying to create a list (L) from items of different lists (a, b, c) but in a specific order (L = [[a1, b1, c1], [a2, b2, c2]...etc]) L = [] a = [1, 2, 3, 4] b = ['a', 'b', 'c', 'd'] c = [2009, 2010, 2011, 2012]
for x, y , z in zip(a, b, c): L.extend([x, y, z]) print L But this outputs: [[1, 'a', 2009]] [[1, 'a', 2009], [2, 'b', 2010]] [[1, 'a', 2009], [2, 'b', 2010], [3, 'c', 2011]] [[1, 'a', 2009], [2, 'b', 2010], [3, 'c', 2011], [4, 'd', 2012]] I just want L = [[1, 'a', 2009], [2, 'b', 2010], [3, 'c', 2011], [4, 'd', 2012]] Saad
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor