Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31949 > unrolled thread
| Started by | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| First post | 2012-10-23 12:56 -0500 |
| Last post | 2012-10-23 12:56 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Fast forward-backward (write-read) Tim Chase <python.list@tim.thechases.com> - 2012-10-23 12:56 -0500
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2012-10-23 12:56 -0500 |
| Subject | Re: Fast forward-backward (write-read) |
| Message-ID | <mailman.2681.1351014931.27098.python-list@python.org> |
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. -tkc
Back to top | Article view | comp.lang.python
csiph-web