sudhir prasad wrote:
hi,
how to clear contents of a file with out actually deleting it,
basically wat im trying to do is copy a source file into a common file ,run the common file,after that i need to copy another source file into the common file,i ant to clear the contents of the common file before copying contents into it.how does f.truncate() helps here


thanks,
sudheer
------------------------------------------------------------------------

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
You can just open the file again in write mode which will truncate it for you. So, f = open(filename, 'w') will clear the contents of your filename (don't forget to close the file when you're done if you do this though).

--
Kind Regards,
Christian Witts


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to