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


Groups > comp.lang.python > #31921

Re: can we append a list with another list in Python ?

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 <fetchinson@googlemail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'syntax': 0.03; 'subject:Python': 0.05; 'append': 0.07; 'python': 0.09; 'received:74.125.82.44': 0.15; 'cheers,': 0.23; 'header:In-Reply- To:1': 0.25; 'skip:[ 10': 0.26; 'guess': 0.27; 'message- id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'routine': 0.29; 'daniel': 0.30; 'subject: ?': 0.30; 'print': 0.32; 'received:74.125.82': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'from:addr:googlemail.com': 0.35; 'but': 0.36; 'received:74.125': 0.36; 'subject:with': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'down!': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=M1/UlPNgHFqx5DFc6JRS15LKElEHobF18Zhy8tSQNJY=; b=xPsnGRZgGPbDI2GcxgTMWPBx0KjFSy/J0IhsIJA/mi6fDJ/BHqivhIfP8yezLtyghl ciD8HHDa6+z7ifhZ8/QIOy4qmhgi+Qj09Y8q/sfna9lMBp6OvQ9SSocf1yY6pjykaQio 8sittrx2mtxmgpJrxJxAlpZual2M/PxbBF5m6tkiVYAAa3dByOLRhDPlF/BQhVaZED5H AwdEVBk14TzpOY+l6lGJlcDGZdHVdi2iDjqqhQMkS8lW53MiyMK+g2ryBdhrHs2hNDJ8 fyWqWYXOh20Lkl6GTlbZM3N6BsA5gOwj1yQdNr3GGX2XRErWR0MDRUTl9lkxB8Mjqcf9 3B2w==
MIME-Version 1.0
In-Reply-To <CAFqGZRHGgN_tEinBku9cj78D_VawZgP3F8k5+FKen0mW3AeVbg@mail.gmail.com>
References <CAFqGZRHGgN_tEinBku9cj78D_VawZgP3F8k5+FKen0mW3AeVbg@mail.gmail.com>
Date Tue, 23 Oct 2012 10:51:32 +0200
Subject Re: can we append a list with another list in Python ?
From Daniel Fetchinson <fetchinson@googlemail.com>
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2653.1350982294.27098.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350982294 news.xs4all.nl 6851 [2001:888:2000:d::a6]:59124
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31921

Show key headers only | View raw


> can we append a list with another list in Python ? using the normal routine
> syntax but with a for loop ??

x = [1,2,3]
y = [10,20,30]
x.extend( y )
print x

this will give you [1,2,3,10,20,30] which I guess is what you want.

Cheers,
Daniel



-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown

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


Thread

Re: can we append a list with another list in Python ? Daniel Fetchinson <fetchinson@googlemail.com> - 2012-10-23 10:51 +0200

csiph-web