superpollo ha scritto:
Oltmans ha scritto:
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:

i think you used te a identifier for two meanings...

        print a

but I was wondering if there is a shorter, more elegant way to do it?


add = lambda a,b: a+b

or:

from operator import add


for i in reduce(add,a):
    print i
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to