ID EN
OS Path

splitdrive

Python 3.11

Split the pathname path into a pair (drive, tail) where drive is either a mount point or the empty string. On systems which do not use drive specifications, drive will always be the empty string. In all cases, drive + tail will be the same as path.

Syntax

PYTHON
os.path.splitdrive(path)

Examples

Example 1
PYTHON
>>> splitdrive("c:/dir")
("c:", "/dir")
Example 2
PYTHON
>>> splitdrive("//host/computer/dir")
("//host/computer", "/dir")

See Also

path-like object