diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 7418f3a8bacb0f..947c58afcd74aa 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2732,7 +2732,10 @@ features: .. function:: remove(path, *, dir_fd=None) Remove (delete) the file *path*. If *path* is a directory, an - :exc:`OSError` is raised. Use :func:`rmdir` to remove directories. + :exc:`OSError` is raised. The exact subclass depends on the platform: + for example, :exc:`IsADirectoryError` on Linux or :exc:`PermissionError` + on macOS. + Use :func:`rmdir` to remove directories. If the file does not exist, a :exc:`FileNotFoundError` is raised. This function can support :ref:`paths relative to directory descriptors