convert list of lists to list

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Tue Jul 22 11:58:32 EDT 2008


antar2 a écrit :
> Is there a way to convert list_of_listsA to list_of_listsB, where one
> list in listof lists A is one element of listB?
> 
> list_of_listsA:
> [['klas*', '*', '*'],
> ['mooi*', '*', '*', '*'],
> ['koe'],
> ['arm*', '*', '*(haar)'],
> ['groei*', '*', '*', '*', '*']]
> 
> listB:
> ['klas* * *', 'mooi* * * *, 'koe',  'arm* * * (haar)',  'groei* * * *
> *']

Your example doesn't match your description. Assuming the example is 
correct and the description incorrect:

listB = [' '.join(sublist) for sublist in list_of_listsA]


NB : totally irrelevant, but your naming convention sucks big time IMHO.




More information about the Python-list mailing list