[Tutor] creating file objects

dman dman@dman.ddts.net
Thu, 2 May 2002 19:08:25 -0500


--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 02, 2002 at 03:59:08PM -0700, Danny Yoo wrote:
|=20
| > Hello, i'v ebene programmingi n python for awhile now, and i was just
| > recently trying to work on file objects.  i can open, read, and write.
| > but i was wondering how i can create a new file object out of nothing.
| > as in make a text file called test.
| >
| > i run linux 2.4 so i was trying the fdopen command but i'm not sure i
| > was getting it write.
|=20
| Hi William,
|=20
| You can just use the open() command that you used to write to files: it
| will automatically create the file for you.=20

Note that the directory in which you are creating the file must exist
before you call open().  There are functions in the os and os.path
modules to work with paths and directories and other file details.

-D

--=20

A)bort, R)etry, D)o it right this time
=20
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg


--EVF5PPMfhYS0aIcm
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjzR1PkACgkQO8l8XBKTpRT4CwCfSZdqpH6cC2xQtADRjKAuk1ZN
sPQAn1D0+Mpf3Pny6cmyKpt7qdaUK6E8
=xiIH
-----END PGP SIGNATURE-----

--EVF5PPMfhYS0aIcm--