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


Groups > comp.lang.python > #69940

how to insert the elements in a list properly?

Date 2014-04-09 16:57 +0800
Subject how to insert the elements in a list properly?
From length power <elearn2014@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.9065.1397039127.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

word=["x1","x2","x3","x4","x5"]
w=word[-2:]
del word[-2:]
word.insert(2,w)
word
['x1', 'x2', ['x4', 'x5'], 'x3']

what i want to get is
['x1', 'x2', 'x4', 'x5', 'x3']

how can i insert them ?

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


Thread

how to insert the elements in a list properly? length power <elearn2014@gmail.com> - 2014-04-09 16:57 +0800

csiph-web