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 ! 3 2606
On Jul 23, 5:33*pm, antar2 <desoth...@yahoo.comwrote:
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 !
Nice and easy. :)
>>list_of_listsA = [['klas*', '*', '*'],
['mooi*', '*', '*', '*'],
['arm*', '*', '*(haar)']]
>>[' '.join(l) for l in list_of_listsA]
['klas* * *', 'mooi* * * *', 'arm* * *(haar)']
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
On 23 Juli, 17:33, antar2 <desoth...@yahoo.comwrote:
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)] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matthew Sims |
last post by:
Python Newbie here. This is my first time learning object-oriented
programming and trying to break out of the usual Korn/Perl/PHP style
of programming. Having some difficulty understand some items....
|
by: Steven Bethard |
last post by:
I think one of the biggest reasons we're having such problems coming
to any agreement on decorator syntax is that each proposal makes a
number of syntax decisions, not just one. For decorators, I...
|
by: Nickolay Kolev |
last post by:
Hi all,
I have a list whose length is a multiple of 3. I want to get a list of
tuples each of which has 3 consecutive elements from the original list,
thus packing the list into smaller...
|
by: Nick Heppleston |
last post by:
I have a concatenation problem and I was wondering if somebody might be
able to offer some help :-)
I have the following table structure holding product long descriptions:
Part...
|
by: Generic Usenet Account |
last post by:
To settle the dispute regarding what happens when an "erase" method is
invoked on an STL container (i.e. whether the element is merely
removed from the container or whether it also gets deleted in...
|
by: Adam Hartshorne |
last post by:
Hi All,
I have the following problem, and I would be extremely grateful if
somebody would be kind enough to suggest an efficient solution to it.
I create an instance of a Class A, and...
|
by: Grzegorz ¦lusarek |
last post by:
Hi all. I my application i have situation when i have some lists and i
must get from lists common elements. Exacly i don't know how many list I
have so at the moment of creation each of one I...
|
by: Zytan |
last post by:
Obviously you can't just use a simple for loop, since you may skip
over elements.
You could modify the loop counter each time an element is deleted.
But, the loop ending condition must be...
|
by: antar2 |
last post by:
Hello,
I am a beginner in python.
following program prints the second element in list of lists 4 for the
first elements in list 4 that are common with the elements in list 5
list4 = ,,]...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
| |