concatenate the elements in each list of a list of lists
Michael Schneider
mischneider1 at googlemail.com
Wed Jul 23 12:45:22 EDT 2008
Am Wed, 23 Jul 2008 08:33:57 -0700 wrote antar2:
> 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 !
Hello,
maybe this will help:
In [5]: list_of_listsA = [['klas*', '*', '*'], ['mooi*', '*', '*', '*'],
['arm*', '* ', '*(haar)']]
In [6]: s = ""
In [7]: print [[s.join(item)] for item in list_of_listsA]
[['klas***'], ['mooi****'], ['arm** *(haar)']]
regards
Michael
More information about the Python-list
mailing list