Is reverse reading possible?

Ivo Python at ivonet.nl
Sun Mar 14 13:03:41 EST 2004


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 at yahoo.com>
To: "py" <python-list at 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
>
>





More information about the Python-list mailing list