os.path.abspath(path) | 返回绝对路径 |
os.path.basename(path) | Return the base name of pathname path. |
os.path.commonpath(paths) | Return the longest common sub-path of each pathname in the sequence paths. |
os.path.commonprefix(list) | Return the longest path prefix (taken character-by-character) that is a prefix of all paths in list. |
os.path.dirname(path) | 返回父文件夹的路径 |
os.path.exists(path) | 判断路径是否存在 |
os.path.lexists(path) | Return True if path refers to an existing path. |
os.path.expanduser(path) | On Unix and Windows, return the argument with an initial component of ~ or ~user replaced by that user’s home directory. |
os.path.expandvars(path) | Return the argument with environment variables expanded. |
os.path.getatime(path) | Return the time of last access of path. |
os.path.getmtime(path) | Return the time of last modification of path. |
os.path.getctime(path) | Return the system’s ctime which, on some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time for path. |
os.path.getsize(path) | Return the size, in bytes, of path. |
os.path.isabs(path) | Return True if path is an absolute pathname. |
os.path.isfile(path) | Return True if path is an existing regular file. |
os.path.isdir(path) | Return True if path is an existing directory. |
os.path.islink(path) | Return True if path refers to an existing directory entry that is a symbolic link. |
os.path.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. |
os.path.join(path, *paths) | Join one or more path components intelligently. |
os.path.normcase(path) | Normalize the case of a pathname. |
os.path.normpath(path) | Normalize a pathname by collapsing redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/…/B all become A/B. |
os.path.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). |
os.path.relpath(path, start=os.curdir) | Return a relative filepath to path either from the current directory or from an optional start directory. |
os.path.samefile(path1, path2) | Return True if both pathname arguments refer to the same file or directory. |
os.path.sameopenfile(fp1, fp2) | Return True if the file descriptors fp1 and fp2 refer to the same file. |
os.path.samestat(stat1, stat2) | Return True if the stat tuples stat1 and stat2 refer to the same file. |
os.path.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. |
os.path.splitdrive(path) | Split the pathname path into a pair (drive, tail) where drive is either a mount point or the empty string. |
os.path.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. |
os.path.supports_unicode_filenames | True if arbitrary Unicode strings can be used as file names (within limitations imposed by the file system). |