Re: Is reverse reading possible?
From: Ivo (Python_at_ivonet.nl)
Date: 03/14/04
- Next message: Jeff Epler: "Re: creating array of python objects"
- Previous message: Anthony Liu: "Re: Is reverse reading possible?"
- Maybe in reply to: Anthony Liu: "Is reverse reading possible?"
- Next in thread: Jeff Epler: "Re: Is reverse reading possible?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
>
>
- Next message: Jeff Epler: "Re: creating array of python objects"
- Previous message: Anthony Liu: "Re: Is reverse reading possible?"
- Maybe in reply to: Anthony Liu: "Is reverse reading possible?"
- Next in thread: Jeff Epler: "Re: Is reverse reading possible?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]