Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70010
| Date | 2014-04-10 13:14 +0800 |
|---|---|
| Subject | how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? |
| From | length power <elearn2014@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9113.1397106891.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
>>> 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.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? length power <elearn2014@gmail.com> - 2014-04-10 13:14 +0800 Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? pete.bee.emm@gmail.com - 2014-04-10 10:36 -0700
csiph-web