Creating files.

Greg Jorgensen gregj at pobox.com
Sat Jan 27 14:02:35 EST 2001


In article <3A72FDD0.2C1206CF at hotmail.com>,
  joonas <keisari_ at hotmail.com> wrote:
> Is there any functions in Python for creating files?

Just open it. If the named file doesn't exist Python will create it.

    f = open("filename", "w")  # opens "filename" for writing
    f.write("hello, world!")
    f.close()

If you are just starting with Python but already know how to program,
the Python Tutorial at www.python.org and the book "Python Essential
Reference" by David Beazley are a good combination. Also look
at "Learning Python" by Mark Lutz.

--
Greg Jorgensen
Portland, Oregon, USA
gregj at pobox.com


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list