P
Peter A. Schott
Been reading the docs saying that file should replace open in our code, but this
doesn't seem to work:
# Open file for writing, write something, close file
MyFile = file("MyFile.txt", "w")
MyFile.write("This is a test.")
MyFile.close()
However, using:
MyFile = open("MyFile.txt", "w")
MyFile.write("This is a test.")
MyFile.close()
I have no problems.
I'm sure that I'm missing something here about using open vs file, but am not
sure what. Probably just mis-read something. If anyone can point me to what I
didn't quite get, I'd appreciate the information.
Thanks.
-Pete
doesn't seem to work:
# Open file for writing, write something, close file
MyFile = file("MyFile.txt", "w")
MyFile.write("This is a test.")
MyFile.close()
However, using:
MyFile = open("MyFile.txt", "w")
MyFile.write("This is a test.")
MyFile.close()
I have no problems.
I'm sure that I'm missing something here about using open vs file, but am not
sure what. Probably just mis-read something. If anyone can point me to what I
didn't quite get, I'd appreciate the information.
Thanks.
-Pete