peter at engcorp.com
Fri Jul 11 15:47:25 CEST 2003
> Peter Hansen <peter at engcorp.com> wrote in message news:<3F0D962E.23DA9F59 at engcorp.com>...
> > "Bartolomé Sintes Marco" wrote:
> > >
> > > I have a program that unzip some zip files. After unzipping them,
> > > I want to delete the zip files with os.remove, but I get this error:
> > > OSError: [Errno 13] Permission denied: ....
> > Close the files properly after unzipping them, perhaps? If that
> > doesn't help, please specify operating system, and give details
> > on how you are unzipping. Is it using Python's zipfile module,
> > or some other method, and exactly how do you do it?
> I want to be able to delete a file on my C: drive through my python
> script. My script writes a file. So i want to delete the file if it
> already exists then write it. What's the best way to do this?
Your question is still not clear, if it's the same as the original
question. Please read http://www.catb.org/~esr/faqs/smart-questions.html
for assistance in formulating your questions a little better.
The simplest answer is that if *you* are creating the files, you
just open them with "w" mode (as in "f = open('filename', 'w')")
and it will automatically truncate the file if it already exists.
Hoping that helps,
More information about the Python-list