[Tutor] write into a file

Khai Nguyen knguyen@seri.co.uk
Wed Jul 23 06:37:02 2003


Hi,

Use writeline or writelines (please see doc)

This script below works fine

"
f=3Dopen('C:/Python22/Tools/tmp/workfile.txt', 'w')
f.writeline('This is the first line of the file')
"

Kind regards




-----Original Message-----
From: Vernon Miller [mailto:vvernon@earthlink.net]=20
Sent: Wednesday, July 23, 2003 5:03 AM
To: Tutor@python.org
Subject: [Tutor] (no subject)


I'm sorry for not giving more info, of course I closed the file after
each time I got through trying to write the input, but it still never
wrote anything to the file until after about 20 to 30 tries but each
time that I went down to the next part and wrote
f.readline() it printed out millions of x's and o's and locked up the
system.

I had problems all day today so I finally uninstalled the python and
lost everything I was working on.

But, and this is the important thing, after reinstalling python, it now
seems to be working. Perhaps there was something wrong with the way I
had installed python. I don't know, but I do know that I spent 3 hrs
trying to get a program to run, after I reinstalled python, it only took
one try to get it to run. Of course I did have to spend 15 minutes
rewriting the file.

Thanks for your input.
Vernon Miller
vvernon@earthlink.net


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


***************************************************************************=
**
The information contained in this email and in any attachments=20
may be privileged and confidential. =20
The information is designated solely for the attention and use of=20
the intended recipient(s). =20
If you are not the intended recipient(s), please be aware that any=20
disclosure, copying, distribution or use of the contents of this=20
information is prohibited.=20
If you have received this email in error, please notify the sender=20
by telephone or email immediately.
***************************************************************************=
**