Python os.path Functions
EditRocket provides the following information on os.path functions in the Python source code builder.
abspath(path) - Return a normalized absolutized version of the pathname path.
basename(path) - Return the base name of pathname path.
commonprefix(list) - Return the longest path prefix (taken character-by-character) that is a prefix of all paths in list.
dirname(path) - Return the directory name of pathname path.
exists(path) - Return True if path refers to an existing path.
expanduser(path) - On Unix, return the argument with an initial component of "~" or "~user" replaced by that user's home directory.
expandvars(path) - Return the argument with environment variables expanded.
getatime(path) - Return the time of last access of path.
getctime(path) - Return the system's ctime which, on some systems (like Unix) is the time of the last change, and, on others (like Windows), is the creation time for path.
getmtime(path) - Return the time of last modification of path.
getsize(path) - Return the size, in bytes, of path.
isabs(path) - Return True if path is an absolute pathname (begins with a slash).
isdir(path) - Return True if path is an existing directory.
isfile(path) - Return True if path is an existing regular file.
islink(path) - Return True if path refers to a directory entry that is a symbolic link.
ismount(path) - Return True if pathname path is a mount point: a point in a file system where a different file system has been mounted.
lexists(path) - Return True if path refers to an existing path.
normcase(path) - Normalize the case of a pathname.
normpath(path) - Normalize a pathname.
realpath(path) - Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path (if they are supported by the operating system).
samefile(path1, path2) - Return True if both pathname arguments refer to the same file or directory (as indicated by device number and i-node number).
sameopenfile(fp1, fp2) - Return True if the file descriptors fp1 and fp2 refer to the same file.
samestat(stat1, stat2) - Return True if the stat tuples stat1 and stat2 refer to the same file.
split(path) - Split the pathname path into a pair, (head, tail) where tail is the last pathname component and head is everything leading up to that.
splitdrive(path) - Split the pathname path into a pair (drive, tail) where drive is either a drive specification or the empty string.
splitext(path) - Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period.
splitunc(path) - Split the pathname path into a pair (unc, rest) so that unc is the UNC mount point (such as r'\\host\mount'), if present, and rest the rest of the path (such as r'\path\file.
walk(path, visit, arg) - Calls the function visit with arguments (arg, dirname, names) for each directory in the directory tree rooted at path (including path itself, if it is a directory).