Sorta noob question - file vs. open?
Russell E. Owen
rowen at cesmail.net
Tue Aug 23 18:58:16 EDT 2005
In article <6a8ng1pjusft9cegb1cb1pvs9gfdknav16 at 4ax.com>,
Peter A. Schott <paschott at no.yahoo.spamm.com> wrote:
>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()
This should work in a sufficiently recent version of python (I'm hedging
because I don't recall when file was introduced -- python 2.2? 2.3?).
What version are you using? What error do you see?
-- Russell
More information about the Python-list
mailing list