PyDocs

File and Directory Access

os.path

Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
Symbols in os.path

a

abspath
Return an absolute path.
ALL_BUT_LAST
Special value used for the strict argument in realpath().
ALLOW_MISSING
Special value used for the strict argument in realpath().

b

basename
Returns the final component of a pathname

c

commonpath
Given a sequence of path names, returns the longest common sub-path.
commonprefix
Given a list of pathnames, returns the longest common leading component

d

dirname
Returns the directory component of a pathname

e

exists
Test whether a path exists.
expanduser
Expand ~ and ~user constructions.
expandvars
Expand shell variables of form $var and ${var}.

g

getatime
Return the last access time of a file, reported by os.stat().
getctime
Return the metadata change time of a file, reported by os.stat().
getmtime
Return the last modification time of a file, reported by os.stat().
getsize
Return the size of a file, reported by os.stat().

i

isabs
Test whether a path is absolute
isdevdrive
Determines whether the specified path is on a Windows Dev Drive.
isdir
Return true if the pathname refers to an existing directory.
isfile
Test whether a path is a regular file
isjunction
Test whether a path is a junction Junctions are not supported on the current platform
islink
Test whether a path is a symbolic link
ismount
Test whether a path is a mount point
isreserved
Return True if path is a reserved pathname on the current system.

j

join
Join two or more pathname components, inserting '/' as needed.

l

lexists
Test whether a path exists.

n

normcase
Normalize case of pathname.
normpath
Normalize path, eliminating double slashes, etc.

r

realpath
Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path.
relpath
Return a relative version of a path

s

samefile
Test whether two pathnames reference the same actual file or directory
sameopenfile
Test whether two open file objects reference the same file
samestat
Test whether two stat buffers reference the same file
split
Split a pathname.
splitdrive
Split a pathname into drive and path.
splitext
Split the extension from a pathname.
splitroot
Split a pathname into drive, root and tail.
supports_unicode_filenames
True if arbitrary Unicode strings can be used as file names (within limitations imposed by the file system).