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: 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: References: <5086AA35.4000509@it.uu.se> Date: Tue, 23 Oct 2012 19:19:28 -0400 Subject: Re: Fast forward-backward (write-read) From: David Hutto To: Virgil Stokes Content-Type: text/plain; charset=ISO-8859-1 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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