Skip to main content

module

path

Implements the os.path operations.

You can import these APIs from the os.path package. For example:

from os.path import isdir

Functions

  • isdir: Return True if path is an existing directory. This follows symbolic links, so both islink() and isdir() can be true for the same path.
  • isfile: Test whether a path is a regular file.
  • islink: Return True if path refers to an existing directory entry that is a symbolic link.
  • exists: Return True if path exists.
  • lexists: Return True if path exists or is a broken symlink.
  • getsize: Return the size, in bytes, of the specified path.
  • join: Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.