Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79066
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:text': 0.05; 'none,': 0.07; 'subject:file': 0.07; 'subject:How': 0.10; 'cc:addr :python-list': 0.11; '-tkc': 0.16; '2):': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:10.216': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'subject:other': 0.31; 'subject:from': 0.34; 'but': 0.35; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'received:10': 0.37; 'to:addr:gmail.com': 0.65; 'joel': 0.91 |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-MC-Relay | Neutral |
| X-MailChannels-SenderId | wwwh|x-authuser|tim@thechases.com |
| X-MailChannels-Auth-Id | wwwh |
| X-MC-Loop-Signature | 1413227372367:1469549765 |
| X-MC-Ingress-Time | 1413227372366 |
| Date | Mon, 13 Oct 2014 14:12:35 -0500 |
| From | Tim Chase <python.list@tim.thechases.com> |
| To | Joel Goldstick <joel.goldstick@gmail.com> |
| Subject | Re: How to select every other line from a text file? |
| In-Reply-To | <CAPM-O+zwF=HzCWFHxUJ2wBMKX+7hr7D3PB4J+abUaHZODur0wg@mail.gmail.com> |
| References | <3be64ca8-d2e7-493a-b4f3-ef114f581450@googlegroups.com> <m1h39u$412$1@reader1.panix.com> <m1h43h$l63$1@ger.gmane.org> <m1h4lt$r3k$1@ger.gmane.org> <CAPM-O+zwF=HzCWFHxUJ2wBMKX+7hr7D3PB4J+abUaHZODur0wg@mail.gmail.com> |
| X-Mailer | Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-AuthUser | tim@thechases.com |
| Cc | "python-list@python.org" <python-list@python.org> |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14832.1413229504.18130.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1413229504 news.xs4all.nl 2951 [2001:888:2000:d::a6]:33908 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:79066 |
Show key headers only | View raw
On 2014-10-13 14:45, Joel Goldstick wrote:
> Not apropos to the OP, but what came up in my mind was to write a
> generator function that returns every other line. This would
> separate the reading from the writing code.
You mean like
offset = 0 # or 1 if you prefer
for line in itertools.islice(source_iter, offset, None, 2):
do_something(line)
?
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to select every other line from a text file? Rff <rwang@avnera.com> - 2014-10-13 10:38 -0700
Re: How to select every other line from a text file? Chris Angelico <rosuav@gmail.com> - 2014-10-14 04:46 +1100
Re: How to select every other line from a text file? Grant Edwards <invalid@invalid.invalid> - 2014-10-13 19:04 +0000
Re: How to select every other line from a text file? John Gordon <gordon@panix.com> - 2014-10-13 17:48 +0000
Re: How to select every other line from a text file? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-13 19:02 +0100
Re: How to select every other line from a text file? emile <emile@fenx.com> - 2014-10-13 11:11 -0700
Re: How to select every other line from a text file? Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-13 14:45 -0400
Re: How to select every other line from a text file? Tim Chase <python.list@tim.thechases.com> - 2014-10-13 14:12 -0500
Re: How to select every other line from a text file? emile <emile@fenx.com> - 2014-10-13 13:01 -0700
Re: How to select every other line from a text file? Gary Herron <gary.herron@islandtraining.com> - 2014-10-13 10:50 -0700
Re: How to select every other line from a text file? Tim Chase <python.list@tim.thechases.com> - 2014-10-13 12:55 -0500
Re: How to select every other line from a text file? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-13 23:54 +0000
Re: How to select every other line from a text file? Dan Stromberg <drsalists@gmail.com> - 2014-10-13 17:34 -0700
csiph-web