Super Newbie Question

joeyjwc at gmail.com joeyjwc at gmail.com
Mon Apr 4 19:39:27 EDT 2005


I have recently started to use Python to develop a new version of my
website.

I'm working on a sort of "web engine" that takes the contents of a
standardized file format I have designed and then outputs it using
templates created by me.

However, I'm only at the very beginning (i.e. opening and reading
files) because I'm a newbie to Python.  I want to spend a lot of time
learning Python.

I have searched with about 15 million different key phrases on Google
and Google Groups but haven't come up with an answer to my following
question:

I want the "engine" to read the file, write its contents to another
temporary file (for now it just writes the contents; later it will
format it before writing the contents) and then deletes the *contents*
of the temporary file after printing out the result, but not the
temporary file itself.  I want it to do this because that temporary
file will be reused to write to for other pages as well.

In short, how might I go about deleting just the contents of a file?
I tried several methods with my limited knowledge but had no luck.

Thank you very much for answering a lowly newbie's question.  I really
appreciate it.

P.S.  If there's a better that you think to perform what I am saying,
I'd like to be enlightened.  But I'd also like my question answered
too, in case I ever need to do something similar again.




More information about the Python-list mailing list