write()

miker2 at optusnet.com.au miker2 at optusnet.com.au
Thu Jul 27 03:05:18 EDT 2006


manuhack wrote:
> How about write mode?  Changing r to w doesn't work...
>
> miker2 at optusnet.com.au wrote:
> > manuhack wrote:
> > > I copied the lines
> > >
> > > f=open('/tmp/workfile', 'w')
> > > print f
> > > f.close()
> > >
> > > from Python 2.4 Documentation 7.2.  But it said IOerror No such file or
> > > directory" '/tmp/workfile'
> > >
> > > Is it something about the os?  I'm using Python 2.4 under WinXP.
> > > Thanks.  Without / I can open it.
> >
> >
> > f=open(r'c:\blah\blah').read()

what is it that you want to do??

in XP if i have or want to create a file in c:\ called test.txt i would
do this:

f = open(r'c:\test.txt', 'w')
f.write("rock the house party")
f.close()




More information about the Python-list mailing list