Windows - create text file - (newb)

epost2 at gmail.com epost2 at gmail.com
Thu Feb 2 17:01:31 EST 2006


Yes. You could do:

Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> fileobj=open('~\myfile.txt','w')
>>> fileobj.write("test")
>>> fileobj.close()

On Windows, for the path to your file, you could write
r'C:\myfile.txt' (if C:\ is a place you can write to.)

also, see the output from

>>> help("open")




More information about the Python-list mailing list