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


Groups > comp.lang.python > #101296

insert many numbers to a list, a second method.

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From "飛飛" <benph@sina.com>
Newsgroups comp.lang.python
Subject insert many numbers to a list, a second method.
Date Tue, 05 Jan 2016 21:36:32 +0800
Lines 7
Message-ID <mailman.25.1452086288.2305.python-list@python.org> (permalink)
Reply-To benph@sina.com
Mime-Version 1.0
Content-Type text/plain; charset=GBK
Content-Transfer-Encoding base64
X-Trace news.uni-berlin.de aVGPShZ93tOP8BNbK5J7twg2XJBMg+P3eaYr8sGm6x4w==
Return-Path <benph@sina.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.698
X-Spam-Level ******
X-Spam-Evidence '*H*': 0.20; '*S*': 0.59; '[0,': 0.09; 'list1': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:list': 0.26; 'subject:numbers': 0.29; 'position.': 0.30; 'to:name:python- list': 0.30; 'skip:- 30': 0.32; 'to:addr:python-list': 0.36; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; 'header :Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'received:122': 0.74; 'received:cn': 0.76; 'from:charset:gbk': 0.84; 'received:172.16.201': 0.84; 'received:60': 0.84; 'received:sina.com.cn': 0.84; 'x-mailer:sina webmail 4.0': 0.84; 'from:addr:sina.com': 0.91; 'reply-to:addr:sina.com': 0.93
X-Sender benph@sina.com
X-SMAIL-MID 44477813001660
X-Priority 3
X-MessageID 568bc6e086c7b19
X-Originating-IP [172.16.201.96]
X-Mailer Sina WebMail 4.0
X-Mailman-Approved-At Wed, 06 Jan 2016 08:18:04 -0500
Content-Disposition inline
X-Content-Filtered-By Mailman/MimeDel 2.1.20+
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:101296

Show key headers only | View raw



--------------------------------
l = list(range(0,12))
numbers = [5,3,2,7]         #insert numbers at 5th position.
list1 = list(range(5,9))
list2 = list(range(0,5))
list2.extend(numbers)     #
for i in list1:
    l.insert(i,list2[i])
print(l)------>           l =  [0, 1, 2, 3, 4, 5, 3, 2, 7, 5, 6, 7, 8, 9, 10, 11]

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


Thread

insert many numbers to a list,  a second method. "飛飛" <benph@sina.com> - 2016-01-05 21:36 +0800

csiph-web