Skip to main content

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) -> bool
function splitroot
splitroot(path: str) -> Tuple[(str, str, str)]
function splitdrive
splitdrive(path: str) -> Tuple[(str, str)]
function join
join(a: str, *paths) -> str
function split
split(path: str) -> Tuple[(str, str)]
function dirname
dirname(path: str) -> str
function basename
basename(path: str) -> str
function splitext
splitext(path: str) -> Tuple[(str, str)]
function normcase
normcase(path: str) -> str
function normpath
normpath(path: str) -> str
function abspath
abspath(path: str) -> str
function relpath
relpath(path: str, start: str = ".") -> str
function commonprefix
commonprefix(paths) -> str
function commonpath
commonpath(paths) -> str
function expanduser
expanduser(path: str) -> str
function expandvars
expandvars(path: str) -> str