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


Groups > comp.lang.python > #32110

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!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
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; 'output': 0.04; 'subject:Python': 0.05; 'python': 0.09; '[0,': 0.09; 'cc:addr :python-list': 0.10; 'aug': 0.13; '12:04': 0.16; '2.7.3': 0.16; 'all...': 0.16; 'oct': 0.16; 'received:209.85.216.53': 0.16; 'skip:> 20': 0.16; 'thanx': 0.16; 'wrote:': 0.17; 'thu,': 0.17; '>>>': 0.18; 'tuples': 0.22; 'example': 0.23; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:[ 10': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'subject: ?': 0.30; 'lists': 0.31; 'problem': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'cc:no real name:2**1': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'skip:l 20': 0.38; 'shows': 0.38; 'header:Received:5': 0.40; 'help': 0.40; 'first': 0.61; 'more': 0.63; 'dont': 0.64; 'more?': 0.91
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 :cc:content-type; bh=Eb9k2/R/lHwDzi8/gORUzvln2cf6S5ZyFXO4jiAxnIM=; b=xSqjks3En6jnaM7vwLEsFbC42oaRVHfs+Ck9qP3lY5ThdTRMyMSGXIcAA6xk+dvL+Z eXVjxaOhKKp0So/8aPpu7vM0bfUQspdbRz/gTUqfoiWE5mVZfhlbYN4JMP/xSobStl55 jTeZonCmtvC7OqmT5+oMNAIvn/ipXmsz2gcaveCjtjVjy/qx1wojmVkYcVZsTF4FxgOU OvgyXTg5eLbo3b5fgBrVU9TVJ1gnXgzhb+1ULTUqoRGmrU7XTVQnjlcDdAXhkxn+2eSX m5+IY1NTWUWgyu/J4B13Moz2wCm0oN2M6jIxR4LUCHUewOQnXsYndIvANRLd8HzHxfGW HQUw==
MIME-Version 1.0
In-Reply-To <CAFqGZREEvDV=MrGCb1g-ZdHu=uENMsoJ05tMKeX5K61NfZAZEQ@mail.gmail.com>
References <CAFqGZRFUk0D_xnTZ19t6pK1dfCDKXct7iNps6MT6yjVFpF+bMw@mail.gmail.com> <901739839.1116059.1350990465261.JavaMail.root@sequans.com> <CAN1F8qXzGO-pav3zrth40JBYNxfxF74ZDaGPnGfKnHZ37x7bYg@mail.gmail.com> <CAN1F8qWWTAoGM_A=V8qKJ9Cp23XiqYyn3ZdeejzB4PzK5djrZw@mail.gmail.com> <CAN1F8qVz7EbHNG5cBz_h7U=jrCp4p42cnT8mdtPuyaCEUYf63w@mail.gmail.com> <CAFqGZRE9P7RxjfR1jj316ozN39rXyWjQzz1yGThYB-vP=mKs1Q@mail.gmail.com> <CAFqGZREsGdQC-b2mGUqRESjfA38L2LJR1b_j62AHm66xwkxpvQ@mail.gmail.com> <50890388.8030809@davea.name> <CAFqGZRG5QytqNxAfh60RNGv1V-DF8938rbDVy8Tf2S5+g4+oGA@mail.gmail.com> <508906DF.1090804@davea.name> <CA+vVgJWynjNZDnunR5Obkde45c546ejLDmM9FLDXbQ5Ht3+hug@mail.gmail.com> <CAFqGZRE57tJTD8HNvxR0rR43scOydnpLcFNOmykcabFuXAAh4Q@mail.gmail.com> <CA+vVgJWmvZ+ixfunHzse+urq9uaGSq4k7WyZCkjGV4WuuLGGvA@mail.gmail.com> <CAFqGZRFdC9aF3STnX9GAcKmwz8=R5vPih2R+Uex_G5KtcdDyZw@mail.gmail.com> <CA+vVgJW9MVtmw+M=Fp2Qy0=WSLTf0EEY0pA3rm_wuWBnDeTsOQ@mail.gmail.com> <CAFqGZREEvDV=MrGCb1g-ZdHu=uENMsoJ05tMKeX5K61NfZAZEQ@mail.gmail.com>
Date Thu, 25 Oct 2012 06:17:12 -0400
Subject Re: can we append a list with another list in Python ?
From David Hutto <dwightdhutto@gmail.com>
To inshu chauhan <insideshoes@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org, d@davea.name
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.2832.1351160234.27098.python-list@python.org> (permalink)
Lines 72
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351160234 news.xs4all.nl 6849 [2001:888:2000:d::a6]:38753
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32110

Show key headers only | View raw


On Thu, Oct 25, 2012 at 6:12 AM, inshu chauhan <insideshoes@gmail.com> wrote:
>
>
> On Thu, Oct 25, 2012 at 12:04 PM, David Hutto <dwightdhutto@gmail.com>
> wrote:
>>
>> On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan <insideshoes@gmail.com>
>> wrote:
>> > Yes Dave ..You are right and my problem is solved now..  Thanx to all...
>> >
>> >
>> > On Thu, Oct 25, 2012 at 11:55 AM, David Hutto <dwightdhutto@gmail.com>
>> > wrote:
>> >>
>> >> On Thu, Oct 25, 2012 at 5:51 AM, inshu chauhan <insideshoes@gmail.com>
>> >> wrote:
>> >> >
>> >> >
>> >> >>
>> >> >> Is this what you mean:
>> >> >>
>> >> list_0 = []
>> >> list_1 = [i for i in range(0,5)]
>> >> list_2 = [i for i in range(5,11)]
>> >> list_0.append(list_1)
>> >> list_0.append(list_2)
>> >> >> >>> for i in list_2:
>> >> >> ...     list_1.append(i)
>> >> >> ...
>> >> >> >>> list_1
>> >> >> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> >> >>
>> >> >>
>> >> >> or would another example help you out more?
>> >> >
>> >> >
>> >> > No but really sorry this is what I DONT WANT.......
>> >> >
>> >> > The output I want to have is :
>> >> >
>> >> > [ [0, 1, 2, 3, 4 ], [5, 6, 7, 8, 9, 10] ].....
>> >>
>> >> Then, this is what you want :
>> >>
>> >> >>david@david-desktop:~$ python
>> >> Python 2.7.3 (default, Aug  1 2012, 05:16:07)
>> >> [GCC 4.6.3] on linux2
>> >> Type "help", "copyright", "credits" or "license" for more information.
>> >> >>> list_0 = []
>> >> >>> list_1 = [i for i in range(0,5)]
>> >> >>> list_2 = [i for i in range(5,11)]
>> >> >>> list_0.append(list_1) list_0 = [list_1,list_2]
>> >> >>> list_0.append(list_2)
>> >> >>> list_0
>> >> [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10]]
>>
>> if you have a format for the lists, there might be an easier way, or
>> simpler. How are the lists coming in?
>>
>> The list are in form of
>>
>>  first list like [(x,y,z) ]
>>
>> and another as [(a,b,c), (a+i, b+i, c+i).............]
>>
This shows tuples though, not appended lists, which are immutable.


-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

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


Thread

Re: can we append a list with another list in Python ? David Hutto <dwightdhutto@gmail.com> - 2012-10-25 06:17 -0400

csiph-web