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


Groups > comp.lang.python > #31922

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 <z@etiol.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'syntax': 0.03; 'subject:Python': 0.05; 'append': 0.07; 'python': 0.09; '[1,': 0.09; '"...': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'routine': 0.29; "i'm": 0.29; 'subject: ?': 0.30; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'subject:with': 0.36; 'october': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:content-type :x-gm-message-state; bh=76Lg2LZdvjiLpm3FNlGAy44quRUSZ8mq4Y2Ya7OhwTU=; b=HwXe83EFAPAzdJwKb8OOkE3qytpdaM+yzDjsGn9+YDmawlDQvb9oSaVR4TsUISzpqn zzfZZjkQl4rkIVLD1fhndtSPUZabnBZ0mzilYwvbO2Xrudb0m2j5sSKM6YYQIfFIi4q1 AiNi55IVhV0NljWOFj4IplgBzCjMbQ9wmTqhKCK90M/dyhTUUrCsTz8l/NVqsSjFpX2z FHxFMVvgWJh8wbRo4jmo9KpXJfQkahHMSBlNY3nYkdQRfdLbpdkIOc1Sg1mP8XHv3tfn 2/JtY+8en4Cvtrxr2jxc95E9GuhOLLKSyJ18KaVTdlzSV/j6iVQQUb0e997LLOrw3wlt 9oMA==
MIME-Version 1.0
Sender z@etiol.net
X-Originating-IP [190.104.31.21]
In-Reply-To <CAFqGZRHGgN_tEinBku9cj78D_VawZgP3F8k5+FKen0mW3AeVbg@mail.gmail.com>
References <CAFqGZRHGgN_tEinBku9cj78D_VawZgP3F8k5+FKen0mW3AeVbg@mail.gmail.com>
From Zero Piraeus <schesis@gmail.com>
Date Tue, 23 Oct 2012 04:56:02 -0400
X-Google-Sender-Auth XYQVOjltK1LPS3FpvsuyDSVbXYc
Subject Re: can we append a list with another list in Python ?
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-Gm-Message-State ALoCoQmfGlDWYmDYK9hTYYgHC1EnaCf+TywxpEGuRTt0b419/3hs6z8A+UVuIEL1TKftxp+jRy65
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.2654.1350982586.27098.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350982586 news.xs4all.nl 6930 [2001:888:2000:d::a6]:35327
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31922

Show key headers only | View raw


:

On 23 October 2012 03:36, inshu chauhan <insideshoes@gmail.com> wrote:
> can we append a list with another list in Python ? using the normal routine
> syntax but with a for loop ??

The standard way to append the contents of one list to another is list.extend:

>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> a.extend(b)
>>> a
[1, 2, 3, 4, 5, 6]

... but I'm not sure what you mean by "... with a for loop"?

 -[]z.

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


Thread

Re: can we append a list with another list in Python ? Zero Piraeus <schesis@gmail.com> - 2012-10-23 04:56 -0400

csiph-web