When will os.remove fail?

Marko Rauhamaa marko at pacujo.net
Mon Mar 13 06:08:37 EDT 2017


eryk sun <eryksun at gmail.com>:

> On Sun, Mar 12, 2017 at 5:48 PM, Steve D'Aprano
> <steve+python at pearwood.info> wrote:
>>
>> Does os.remove work like this under Windows too?
>
> os.remove calls DeleteFile on Windows. [...]

Fascinating info, Eryk.

The difference between file removal in Linux and Windows is a bit like
the difference between object destrution in C++ and Python. In C++, you
destroy an object with a "delete" statement. In Python, you can't
destroy an object, you can simply lose all references to it.


Marko


More information about the Python-list mailing list