Flatten a two-level list --> one liner?

Sergio Correia sergio.correia at gmail.com
Wed Mar 7 19:41:16 EST 2007


I forgot to say: I've already checked the discussions about
recursive/iterative/etc flatten() functions that can sweep through a
list of arbitrary length, but that's really overkill for what I want.

However, "sum(eggs, [])" or itertools seem to do it w/out the need for
a new function.

Thanks a lot!

Sergio

On 3/7/07, Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:
> En Wed, 07 Mar 2007 21:14:43 -0300, Sergio Correia
> <sergio.correia at gmail.com> escribió:
>
> > I'm looking for an easy way to flatten a two level list like this
>
> Try google.
>
> > PS: Why does `sum` works only with numbers?
>
> Try google.
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list