Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31952
| Date | 2012-10-23 20:37 +0200 |
|---|---|
| From | Virgil Stokes <vs@it.uu.se> |
| Subject | Re: Fast forward-backward (write-read) |
| References | <5086AA35.4000509@it.uu.se> <5086C156.40707@tim.thechases.com> <5086D13F.80006@it.uu.se> <5086DA4D.4060204@tim.thechases.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2683.1351018926.27098.python-list@python.org> (permalink) |
On 23-Oct-2012 19:56, Tim Chase wrote: > On 10/23/12 12:17, Virgil Stokes wrote: >> On 23-Oct-2012 18:09, Tim Chase wrote: >>>> Finally, to my question --- What is a fast way to write these >>>> variables to an external file and then read them in >>>> backwards? >>> Am I missing something, or would the fairly-standard "tac" >>> utility do the reversal you want? It should[*] be optimized to >>> handle on-disk files in a smart manner. >> Not sure about "tac" --- could you provide more details on this >> and/or a simple example of how it could be used for fast reversed >> "reading" of a data file? > Well, if you're reading input.txt (and assuming it's one record per > line, separated by newlines), you can just use > > tac < input.txt > backwards.txt > > which will create a secondary file that is the first file in reverse > order. Your program can then process this secondary file in-order > (which would be backwards from your source). > > I might have misunderstood your difficulty, but it _sounded_ like > you just want to inverse the order of a file. Yes, I do wish to inverse the order, but the "forward in time" file will be in binary. --V
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Fast forward-backward (write-read) Virgil Stokes <vs@it.uu.se> - 2012-10-23 20:37 +0200
Re: Fast forward-backward (write-read) Paul Rubin <no.email@nospam.invalid> - 2012-10-23 16:46 -0700
Re: Fast forward-backward (write-read) Dave Angel <d@davea.name> - 2012-10-28 07:18 -0400
Re: Fast forward-backward (write-read) Virgil Stokes <vs@it.uu.se> - 2012-10-28 15:20 +0100
Re: Fast forward-backward (write-read) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-28 18:21 +0000
Re: Fast forward-backward (write-read) Virgil Stokes <vs@it.uu.se> - 2012-10-28 23:36 +0100
csiph-web