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


Groups > comp.lang.python > #69940 > unrolled thread

how to insert the elements in a list properly?

Started bylength power <elearn2014@gmail.com>
First post2014-04-09 16:57 +0800
Last post2014-04-09 16:57 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#69940 — how to insert the elements in a list properly?

Fromlength power <elearn2014@gmail.com>
Date2014-04-09 16:57 +0800
Subjecthow to insert the elements in a list properly?
Message-ID<mailman.9065.1397039127.18130.python-list@python.org>

[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 ?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web