file.readlines() - gives me error (bad file descriptor)

Binu K S binux.lists at gmail.com
Thu Jan 6 05:15:39 EST 2005


http://mail.python.org/pipermail/python-bugs-list/2001-October/007650.html
Rest assured you're not on drugs :)

On Thu, 6 Jan 2005 14:45:24 +0530, Gurpreet Sachdeva
<gurpreet.sachdeva at gmail.com> wrote:
> On Thu, 6 Jan 2005 14:27:40 +0530, Binu K S <binux.lists at gmail.com> wrote:
> > I'm sorry, I didn't get what you trying to say here. Where do you see
> > a read altering the file? An example might help.
> 
> Please try:
> 
> logfile=file(r'test.txt','w+')
> logfile.write('datetime')
> 
> Check the contents of test.txt, you will get what ever was required...
> 
> Now Run:
> 
> logfile=file(r'test.txt','w+')
> logfile.write('datetime')
> logfile.readlines()
> 
> and check the contents of test.txt???
> My doubt is that logfile.write('datetime') will write datetime that is
> universaly accepted but why all that junk is appending to that when I
> add logfile.readlines()
> 
> Strange or Am I on drugs??? :o)
> 
> Please Comment...
> 
> Garry
>



More information about the Python-list mailing list