os._ntpath

Standard library module View source

Windows string path operations, importable on every target.

Lexical operations follow Python 3.13 Windows path rules. They do not inspect the filesystem or resolve symlinks. Relative abspath() and relpath() need Windows' current-directory and per-drive state; on other targets only fully qualified paths can be resolved. Environment expansion has a mapping-based helper for host-independent tests.

variable curdir
curdir: Literal[str] = "."
variable pardir
pardir: Literal[str] = ".."
variable sep
sep: Literal[str] = "\\"
variable pathsep
pathsep: Literal[str] = ";"
variable defpath
defpath: Literal[str] = ".;C:\\bin"
variable extsep
extsep: Literal[str] = "."
variable altsep
altsep: Optional[str] = "/"
variable devnull
devnull: Literal[str] = "nul"
function isabs
isabs(path: str)
function splitroot
splitroot(path: str)
function splitdrive
splitdrive(path: str)
function join
join(a: str, *paths)
function split
split(path: str)
function dirname
dirname(path: str)
function basename
basename(path: str)
function splitext
splitext(path: str)
function normcase
normcase(path: str)
function normpath
normpath(path: str)
function abspath
abspath(path: str)
function relpath
relpath(path: str, start: str = ".")
function commonprefix
commonprefix(paths)
function commonpath
commonpath(paths)
function expanduser
expanduser(path: str)
function expandvars
expandvars(path: str)