On Sat, May 8, 2010 at 1:41 PM, Oltmans <rolf.oltm...@gmail.com> wrote: > Hi, I've a list that looks like following > > a = [ [1,2,3,4], [5,6,7,8] ] > > Currently, I'm iterating through it like > > for i in [k for k in a]: > for a in i: > print a > > but I was wondering if there is a shorter, more elegant way to do it?
Just use a different variable name besides `a` in the nested loop so you don't have to make the copy of `a`. I arbitrarily chose `b`: for i in a: for b in i: print b Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list