ID EN
OS Path

dirname

Python 3.11

Return the directory name of pathname path. This is the first element of the pair returned by passing path to the function split().

Syntax

PYTHON
os.path.dirname(path)

See Also

split() path-like object