[EMAIL PROTECTED] wrote:
Hey guys,
I can't figure this one out, why is this simple script giving me
problems?
logfile=file(r'test.txt','w')
logfile.write('datetime')
test=logfile.readlines()
When I run it I get the error message:
Traceback (most recent call last):
File "C:\Documents and Settings\Gr
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
<[EMAIL PROTECTED]> wrote:
> On Thu, 6 Jan 2005 14:27:40 +0530, Binu K S <[EMAIL PROTECTED]> wrote:
> > I'm sorry, I didn't get what y
On Thu, 6 Jan 2005 14:27:40 +0530, Binu K S <[EMAIL PROTECTED]> 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, y
On Thu, 6 Jan 2005 13:17:11 +0530, Gurpreet Sachdeva
<[EMAIL PROTECTED]> wrote:
> On Thu, 6 Jan 2005 12:55:22 +0530, Binu K S <[EMAIL PROTECTED]> wrote:
> >>>The file's current position moves as you write into it.
> I concure and have figured out the solution BUT while reading from the
> file from
On Thu, 6 Jan 2005 12:55:22 +0530, Binu K S <[EMAIL PROTECTED]> wrote:
>>>The file's current position moves as you write into it.
I concure and have figured out the solution BUT while reading from the
file from the position where the file handler is, should return
"Null/Blank/Anything in this world
There's nothing crazy going on here. The file's current position moves
as you write into it. Both read and write operation use the same
offset. The tell() method gives you the current position at any time.
When you append to a file the position moves to the end of the file so
that the next write ha
logfile=file(r'test.txt','a+')
logfile.write('datetime')
logfile.flush()
test=logfile.readlines()
print test
I added logfile.flush(), the 'datetime' was written in the file
correctly but I couldn't get any result...
Crazy!
Garry
--
http://mail.python.org/mailman/listinfo/python-list
test=logfile.readlines()
>
>
> ~Vishnu.
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Thursday, January 06, 2005 11:53 AM
> To: python-list@python.org
> Subject: file.readlines() - giv
Thus spake [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> Hey guys,
>
> I can't figure this one out, why is this simple script giving me
> problems?
>
> logfile=file(r'test.txt','w')
^^^
You've opened the file in write mode. To read from the file,
you'll have to reopen it i
ge-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 11:53 AM
To: python-list@python.org
Subject: file.readlines() - gives me error (bad file descriptor)
Hey guys,
I can't figure this one out, why is this simple script giv
Hey guys,
I can't figure this one out, why is this simple script giving me
problems?
logfile=file(r'test.txt','w')
logfile.write('datetime')
test=logfile.readlines()
When I run it I get the error message:
Traceback (most recent call last):
File "C:\Documents and Settings\Gregory\My Documents\Get
11 matches
Mail list logo