[Tutor] how to save text or dat file using python

Dave Angel d at davea.name
Fri Sep 28 14:19:57 CEST 2012


On 09/20/2012 12:14 PM, Preeti Gaikwad wrote:
>   Hello I am new user of python pls let me know how to save dat or txt file
> using python? what is the basic cmd for this? thanks a lot in advance
>
>

Have you written any code that READs files?

Check out the open() function, in particular the "w" or "wb" mode.

Then use the method write(), on the file object returned by open().

-- 

DaveA



More information about the Tutor mailing list