Creating files.

David Allen s2mdalle at titan.vcu.edu
Sat Jan 27 13:50:00 EST 2001


In article <3A72FDD0.2C1206CF at hotmail.com>, "joonas" <keisari_ at hotmail.com>
wrote:

> Is there any functions in Python for creating files?
> 
> Joonas.

Open it for writing, and that's about it.  

fp = open("somefile", "w")
fp.flush()
fp.close()

Congrats, "somefile" now exists with a 0 size.

Alternately, you could through the shell "touch"
the file if you're on a unix system.

-- 
David Allen
http://opop.nols.com/
----------------------------------------
"As soon as we started programming, we found to our surprise that it wasn't as 
easy to get programs right as we had thought. Debugging had to be discovered. 
I can remember the exact instant when I realized that a large part of my life 
from then on was going to be spent in finding mistakes in my own programs." 
	- Maurice Wilkes discovers debugging, 1949



More information about the Python-list mailing list