[Tutor] read, write to file

Khai Nguyen knguyen@seri.co.uk
Wed Jul 23 06:50:01 2003


Hi,

Use writeline or writelines (please see doc)

This script below works fine

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

Kind regards

-----Original Message-----
From: Vernon Miller [mailto:vvernon@earthlink.net]=20
Sent: Tuesday, July 22, 2003 12:15 AM
To: Tutor@python.org
Subject: [Tutor] read, write to file


I spend all day trying to get this to work

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

after it finally seemed to work I tried to read the line with readline()

What I got was several hundred lines of x's and o's, but nothing was
written to the file

last week I went through the same thing and after rebooting several
times it finally decided to work, it seems to me that there is something
fundamentally wrong with the read, write to file functions in this
latest version of python.

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.
***************************************************************************=
**