Primary
os.remove() ⚬|Documentation|1st|20251021120818-00-⌔
os — Miscellaneous operating system interfaces — Python 3 documentation#os.remove
os.remove(path, ﹡, dir_fd=None)Remove (delete) the file path. If path is a directory, an
OSErroris raised. Usermdir()to remove directories. If the file does not exist, aFileNotFoundErroris raised.This function can support paths relative to directory descriptors.
On Windows, attempting to remove a file that is in use causes an exception to be raised; on Unix, the directory entry is removed but the storage allocated to the file is not made available until the original file is no longer in use.
This function is semantically identical to
unlink().Raises an auditing event
os.removewith argumentspath,dir_fd.Changed in version 3.3: Added the dir_fd parameter.
Changed in version 3.6: Accepts a path-like object.
Printed 2026-06-28.
(echo:: @ ᯤ)
Link to original
Secondary
• • •