Peter A. Schott wrote:
> Been reading the docs saying that file should replace open in our code, but 
> this
> doesn't seem to work:
This was really a misstatement; open is still preferred.  file is now
a built in class, and its constructor is the same as open.  I think the
current docs have been fixed.

> # Open file for writing, write something, close file
> MyFile = file("MyFile.txt", "w")
> MyFile.write("This is a test.")
> MyFile.close()
But you've given us no idea what went wrong.

> However, using:
> MyFile = open("MyFile.txt", "w")
> MyFile.write("This is a test.")
> MyFile.close()
I cannot help you if you don't tell me what went wrong.

Both bits of code seem to do the same thing for me.


--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to