Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70012

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

References <CAOmh462zZbe29dPL1nV7YokJObwuHXu0_K5PxD1gUr_=RB73mA@mail.gmail.com>
From balaji marisetti <balajimarisetti@gmail.com>
Date 2014-04-10 10:55 +0530
Subject Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?
Newsgroups comp.lang.python
Message-ID <mailman.9115.1397107547.18130.python-list@python.org> (permalink)

Show all headers | View raw


There was long thread discussing flattening of a list on this list :).
See the link below.

https://mail.python.org/pipermail/python-list/2014-March/669256.html

On 10 April 2014 10:44, length power <elearn2014@gmail.com> wrote:
>>>> x=["a","b",["c","d"],"e"]
>>>> y=x[2]
>>>> y
> ['c', 'd']
>>>> x.insert(2,y[0])
>>>> x
> ['a', 'b', 'c', ['c', 'd'], 'e']
>>>> x.insert(3,y[1])
>>>> x
> ['a', 'b', 'c', 'd', ['c', 'd'], 'e']
>>>> del x[4]
>>>> x
> ['a', 'b', 'c', 'd', 'e']
>>>>
> maybe there is a more smart way to do.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
:-)balaji

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? balaji marisetti <balajimarisetti@gmail.com> - 2014-04-10 10:55 +0530
  Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? Rustom Mody <rustompmody@gmail.com> - 2014-04-09 22:38 -0700
    Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? Boris Borcic <bborcic@gmail.com> - 2014-04-10 16:14 +0200

csiph-web