[Tutor] Create text file
Lloyd Kvam
pythonTutor at venix.com
Thu Jul 1 09:36:08 EDT 2004
Simply use the Python file object with a t appended to the mode:
textfile = file('new_file.txt','wt')
This is a link to the tutorial. Note that open also returns file
objects. file is a recent addition to the language.
http://python.org/doc/2.3.4/tut/node9.html#l2h-30
On Thu, 2004-07-01 at 09:17, Bernard Lebel wrote:
> Hello,
>
> I searched througout the Python docs but can't find anything about that.
>
> Is there a way to create a text file in Python?
> So far I'm using a FileSystemObject (wich is an ActiveX object, running
> inside the Win32 module), in the form of
>
> fso.createtextfile( )
>
> But I'd like to stay away from active objects to maximize Windows-Linux
> compatibility.
>
> Any advince would be very welcomed.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice: 603-653-8139
fax: 801-459-9582
More information about the Tutor
mailing list