Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.033 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.01; '16,': 0.03; 'skip:[ 20': 0.04; 'cc:addr:python-list': 0.11; 'assume': 0.14; 'array.': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'array': 0.29; 'dec': 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'continues': 0.31; 'display': 0.35; 'received:google.com': 0.35; 'rather': 0.38; 'how': 0.40; 'such': 0.63; 'grab': 0.64; 'to:none': 0.92; 'hundred': 0.95; '2013': 0.98 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:cc :content-type:content-transfer-encoding; bh=LL6W2xOqJkv5MKp3cEjf44Z6TUhzX7LPlpSFk6JaqDo=; b=Hxlt6aUtxzgcBhQ0gMiaKnpSjooHKHrEqDd9SPpcezDAqSoEgs99DQLWu6R8WMNHG1 zZAslA8t7E4qG8uOjbV4jXJVqaYQGxtr1LRcHwuPXLNut4Nc3hAAq234zMK1+GLzWLrD bPCNAi7RpbDp0IMG3Kd0L5RzJSQQrMUV+u06+t4TUFVnQDDMwR1TH/cfAj92DdeAjXz/ Yza5VJUxx45vHCl94COImPMZIdLPx99EmlE4JPZZtEbkNespCmbZVbcmxYPTvBLI8S/M 2AV7U9OSnukjtn/xj3+865E7EmcpXrY6N29l1d1k6zcR24Oy2O3zx1qPblmA9ayVAQRs kcLA== MIME-Version: 1.0 X-Received: by 10.182.129.201 with SMTP id ny9mr11428725obb.0.1387197718027; Mon, 16 Dec 2013 04:41:58 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Dec 2013 07:41:57 -0500 Subject: Re: Wrapping around a list in Python. From: David Robinow Cc: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387197726 news.xs4all.nl 2897 [2001:888:2000:d::a6]:54665 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62055 On Mon, Dec 16, 2013 at 12:26 AM, wrote: > The idea is to grab the last 4 elements of the array. However i have an a= rray that contains a few hundred elements in it. And the values continues t= o .append over time. How would i be able to display the last 4 elements of = the array under such a condition? I assume you mean 'list' rather than 'array'. If all you want to do is 'display' the last 4 elements: big_list =3D [0,1,2,3,4,5,6,7,8,9] last4 =3D big_list[-4:] print(last4)