Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31970

Re: Fast forward-backward (write-read)

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.063
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; 'f.close()': 0.07; 'filename': 0.07; 'cc:addr:python-list': 0.10; "'r')": 0.16; 'backward': 0.16; 'received:209.85.216.53': 0.16; 'not,': 0.21; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'skip:[ 10': 0.26; 'skip:" 20': 0.26; 'message- id:@mail.gmail.com': 0.27; 'print': 0.32; 'received:google.com': 0.34; 'received:209.85': 0.35; 'subject: (': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'skip:" 10': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'forward': 0.66; 'forward,': 0.84; 'subject:Fast': 0.84; 'subject:read': 0.84; 'subject:write': 0.84
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:to :cc:content-type; bh=414IyEFa7DW99DhFsrxMvMCt/SdHjWARC/hC0zBDrXY=; b=WzEM+Orrq/HDfm7VKiGVTzPyf3GDeY1H4hoVRKNpuqVm5mmqJt2ywUMP41CoBAcTJV OeaAUACaJnkdL9Dqc+/k5P7t1kba8yqn2yZmzb4EA3CBj5ScqDYxY1Mxb4vV0T7rnRxc v9VMO4uOffI1nF/c/xyUPr3w0ADgdxV215nQXGxwM3k26GRH/1R63IOnHEDyYRMWyiHR gR1PMm3GHQytpK/HVEJA7C3YnGV8652iFeBgwbxvlmv3HfDum633ywGZKzcPVRJ197RO FwDUQv3BLwUF9LYZEXWzwNNLidxno32c0gpfoS86ULwUvdOyrjY1RJHnkzS+ikHZEpO+ R4LA==
MIME-Version 1.0
In-Reply-To <CA+vVgJUNOZD3vBVFDXvXzdXb=c5THQG+B5dSOp_uF1nqDHhPug@mail.gmail.com>
References <5086AA35.4000509@it.uu.se> <CA+vVgJV6feUL0gTPC==3fp3Wq8zvRXgoyhVaUYnZNtMfF8qpLw@mail.gmail.com> <CA+vVgJWnAThHhD4cUJzXLGdVojCNA1oV_qKYwa+7UsEqS=x7XQ@mail.gmail.com> <CA+vVgJUNOZD3vBVFDXvXzdXb=c5THQG+B5dSOp_uF1nqDHhPug@mail.gmail.com>
Date Tue, 23 Oct 2012 19:19:28 -0400
Subject Re: Fast forward-backward (write-read)
From David Hutto <dwightdhutto@gmail.com>
To Virgil Stokes <vs@it.uu.se>
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2699.1351034371.27098.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351034371 news.xs4all.nl 6954 [2001:888:2000:d::a6]:40810
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31970

Show key headers only | View raw


Whether this is fast enough, or not, I don't know:


filename = "data_file.txt"
f = open(filename, 'r')
forward =  [line.rstrip('\n') for line in f.readlines()]
backward =  [line.rstrip('\n') for line in reversed(forward)]
f.close()
print forward, "\n\n", "********************\n\n", backward, "\n"


-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fast forward-backward (write-read) David Hutto <dwightdhutto@gmail.com> - 2012-10-23 19:19 -0400

csiph-web