Remove a directory

suggest change

Remove the directory at path:

os.rmdir(path)

You should not use os.remove() to remove a directory. That function is for files and using it on a directory raises an OSError. On Windows that is PermissionError (WinError 5). On POSIX it is IsADirectoryError. This assumes import os.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents