Re: Is reverse reading possible?

From: Ivo (Python_at_ivonet.nl)
Date: 03/14/04


Date: Sun, 14 Mar 2004 19:03:41 +0100
To: "Anthony Liu" <antonyliu2002@yahoo.com>, "py" <python-list@python.org>

Hi,

Depends on how large your file is but it is realy easy to do:

f = open("your file","r")
inp = f.readlines() # read it all into memory (here it depends on the
largeness of your file)
inp.reverse() # reverse your input
for x in inp: #normal looping
  do your stuff

----- Original Message -----
From: "Anthony Liu" <antonyliu2002@yahoo.com>
To: "py" <python-list@python.org>
Sent: Sunday, March 14, 2004 5:40 PM
Subject: Is reverse reading possible?

> In terms of file input, can we read from the end of
> the file till the beginning of a file?
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
> http://mail.yahoo.com
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>