Converting a tuple to a list

Shane Geiger sgeiger at ncee.net
Tue Apr 8 19:58:56 EDT 2008


from goopy.functional import *

tupla = ((1,2), (3,4), (5,6))

print flatten(tupla)




Gabriel Ibanez wrote:
> Hi all ..
>
> I'm trying to using the map function to convert a tuple to a list, without 
> success.
>
> I would like to have a lonely line that performs the same as loop of the 
> next script:
>
> -------------------------------------------
> # Conveting tuple -> list
>
> tupla = ((1,2), (3,4), (5,6))
>
> print tupla
>
> lista = []
> for a in tupla:
>     for b in a:
>         lista.append(b)
> print lista
> -------------------------------------------
>
> Any idea ?
>
> Thanks ...
>
> # Gabriel
>
>   


-- 
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy




More information about the Python-list mailing list