Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'syntax': 0.03; 'subject:Python': 0.05; 'modify': 0.05; 'append': 0.07; 'python': 0.09; 'cc:addr:python-list': 0.10; 'obviously,': 0.16; 'received:192.168.11': 0.16; 'wrote:': 0.17; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'subject:list': 0.28; 'leaves': 0.29; 'routine': 0.29; 'subject: ?': 0.30; 'another': 0.33; 'list': 0.35; 'but': 0.36; 'subject:with': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'first': 0.61; 'of:': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84 Date: Tue, 23 Oct 2012 09:13:50 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: inshu chauhan Subject: Re: can we append a list with another list in Python ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:2X0Ah6FceQFuGyXnWOoyv0Pox8gBtI+xgjVGuVF8vlR mxFh34WOChy7vlQ0Y9w3W3v8SJGNvlwxy1amRnJJTNsEGJxYO4 KlIdpNR7HJ0NU2nJVWQ0Rp3WDcrfQGi1y6oRGIu3dNwDMfG0qy 4TgmUkU8q8mBPI9ncjNlUq6LuzasyeaYeGpKF2lzJ10y2x2bsC T8LqSufqpI9SvcGc3hXGfz3XLtBd6LSendpYU0AIZxrs/C4eLX FNtk871+fqBu2aaJJaOlJx+PikjpT0VI01HoOwMmYFAZ4gbp+7 oLaOb+i0z6VifzpnT9Z29YrQ05JY5UgVnA+g3TiQXMnZxJA6Lo T7MAPGmIVI1RcEMF4ZK8= Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350998546 news.xs4all.nl 6983 [2001:888:2000:d::a6]:48589 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31931 On 10/23/2012 03:36 AM, inshu chauhan wrote: > can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? > > To combine list a with list b, you can do any of: c = a + b a += b a.extend(b) Obviously, the first leaves a unmodified, while the other two modify it in-place. -- DaveA