In [1]: list_ = ['did', 'is', 'not', 'come', 'will', 'kill', 'are', 'not'] In [2]: res = [" ".join(elements).strip() for elements in " ".join(list_).split("not") if elements] In [3]: res Out[3]: ['d i d i s', 'c o m e w i l l k i l l a r e']
How can I unite some elems in the list?
How can I unite some elems in the list?
|
|
Messages In This Thread |
How can I unite some elems in the list? - by Mike Ru - Jul-23-2017, 10:25 PM
RE: How can I unite some elems in the list? - by Larz60+ - Jul-23-2017, 10:45 PM
RE: How can I unite some elems in the list? - by Mike Ru - Jul-24-2017, 05:04 PM
RE: How can I unite some elems in the list? - by wavic - Jul-25-2017, 07:21 AM
RE: How can I unite some elems in the list? - by Mike Ru - Jul-25-2017, 08:46 AM
RE: How can I unite some elems in the list? - by buran - Jul-25-2017, 10:50 AM
RE: How can I unite some elems in the list? - by nilamo - Jul-26-2017, 04:28 PM
RE: How can I unite some elems in the list? - by snippsat - Jul-26-2017, 05:38 PM
|
Users browsing this thread: 1 Guest(s)