Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:text': 0.05; 'none,': 0.07; 'subject:file': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; 'python': 0.11; '2):': 0.16; 'did.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'library': 0.18; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'chase': 0.31; 'subject:other': 0.31; 'subject:from': 0.34; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'different': 0.65; 'received:pacbell.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: emile Subject: Re: How to select every other line from a text file? Date: Mon, 13 Oct 2014 13:01:24 -0700 References: <3be64ca8-d2e7-493a-b4f3-ef114f581450@googlegroups.com> <20141013141235.4c551f37@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-69-226-129-65.dsl.pltn13.pacbell.net User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <20141013141235.4c551f37@bigbox.christie.dr> 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413230517 news.xs4all.nl 2972 [2001:888:2000:d::a6]:39079 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3104 X-Received-Body-CRC: 3884846985 Xref: csiph.com comp.lang.python:79067 On 10/13/2014 12:12 PM, Tim Chase wrote: > You mean like > > offset = 0 # or 1 if you prefer > for line in itertools.islice(source_iter, offset, None, 2): > do_something(line) I certainly did. Learning the python standard library is different from learning python and each in its own time. Emile