os.path

Standard library module View source

Native path operations (POSIX, or Windows when targeting win32).

variable curdir
curdir: Literal[str] = "."
variable pardir
pardir: Literal[str] = ".."
variable extsep
extsep: Literal[str] = "."
function exists
exists(path: str)
function lexists
lexists(path: str)
function isfile
isfile(path: str)
function isdir
isdir(path: str)
function samefile
samefile(path1: str, path2: str)
function sameopenfile
sameopenfile(fd1: int, fd2: int)
function getsize
getsize(path: str)
function getmtime
getmtime(path: str)
function getatime
getatime(path: str)
function getctime
getctime(path: str)
function expanduser
expanduser(path: str)
function realpath
realpath(path: str, strict: bool = False)
function isabs
isabs(path: str)
function join
join(a: str, *paths)
function split
split(path: str)
function dirname
dirname(path: str)
function basename
basename(path: str)
function splitdrive
splitdrive(path: str)
function splitroot
splitroot(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 expandvars
expandvars(path: str)
function splitext
splitext(p: str)

Split a pathname into (root, ext).

The extension runs from the last dot to the end, ignoring leading dots.
`ext` may be empty.