concatenate the elements in each list of a list of lists

Niklas Norrthon niklas.norrthon at hotmail.com
Wed Jul 23 16:21:04 EDT 2008


On 23 Juli, 17:33, antar2 <desoth... at yahoo.com> wrote:
> I already asked a similar question, but encounter problems with
> python...
> How can I concatenate the elements in each list of a list of lists
>
> list_of_listsA =
>
> [['klas*', '*', '*'],
> ['mooi*', '*', '*', '*'],
> ['arm*', '*', '*(haar)']]
>
> wanted result:
>
> list_of_listsA =
>
> [['klas* * *']
> ['mooi* * * *']
> ['arm* * *(haar)']]
>
> Thanks a lot !

wanted_result = [[item] for item in map(' '.join, list_of_listsA)]



More information about the Python-list mailing list