[Tutor] write to a file
Gus Tabares
gus.tabares@verizon.net
Mon, 19 Aug 2002 18:10:10 -0400
Thanks to all who responded, it was more than I was expecting;)
Gus
-----Original Message-----
From: python [mailto:python@inkedmn.net]
Sent: Friday, August 16, 2002 5:45 PM
To: Gus Tabares
Cc: tutor@python.org
Subject: Re: [Tutor] write to a file
it goes something like this:
file = file('C:\filename.txt', 'w')
x = 'hello, sir'
file.write(x)
that will write the string x to the file filename.txt
best of luck,
brett
GT> Hello,
GT> I'm trying write something to a file but I keep on getting this
error:
GT> Traceback (most recent call last):
GT> File "test.py", line 9, in ?
GT> os.open("C:\blah.txt", 'w')
GT> TypeError: an integer is required
GT> I don't see what an integer has to do with anything? Thanks in
advance...
GT> Gus
GT> _______________________________________________
GT> Tutor maillist - Tutor@python.org
GT> http://mail.python.org/mailman/listinfo/tutor