On this page
  1. os.rmdir
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

os.rmdir

Prev: os.replace | Up: os | Next: os.scandir
Rel: os.abort, os.access, os.chdir, os.chmod
Ref: docs.python.org — os.rmdir
Tags: #public #python3 #stdlib #os


Import

import os
from os import rmdir

Signature & Overview

os.rmdir(path, *, dir_fd=None)

Remove a directory.

Usage

import os
from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as tmp:
    empty = Path(tmp) / "empty"
    empty.mkdir()
    os.rmdir(empty)
    assert not empty.exists()

Gotchas

REPL Inspect

from os import rmdir
help(rmdir)

Linked from

Related notes