Back to module index

Go to module by name

pathlib

This module has no docstring.

Classes

Path

PurePath subclass that can make system calls.

    Path represents a filesystem path but unlike PurePath, also offers
    methods to do system calls on path objects. Depending on your system,
    instantiating a Path will return either a PosixPath or a WindowsPath
    object. You can also instantiate a PosixPath or WindowsPath directly,
    but cannot instantiate a WindowsPath on a POSIX system or vice versa.
    
absolute(self)

  Return an absolute version of this path.  This function works
          even if the path doesn't point to anything.

          No normalization is done, i.e. all '.' and '..' will be kept along.
          Use resolve() to get the canonical path to a file.
        
as_posix(self)

  Return the string representation of the path with forward (/)
          slashes.
as_uri(self)

  Return the path as a 'file' URI.
chmod(self, mode, *, follow_symlinks=True)


          Change the permissions of the path, like os.chmod().
        
cwd()

  Return a new path pointing to the current working directory
          (as returned by os.getcwd()).
        
exists(self)


          Whether this path exists.
        
expanduser(self)

   Return a new path with expanded ~ and ~user constructs
          (as returned by os.path.expanduser)
        
glob(self, pattern)

  Iterate over this subtree and yield all existing files (of any
          kind, including directories) matching the given relative pattern.
        
group(self)


          Return the group name of the file gid.
        
hardlink_to(self, target)


          Make this path a hard link pointing to the same file as *target*.

          Note the order of arguments (self, target) is the reverse of os.link's.
        
home()

  Return a new path pointing to the user's home directory (as
          returned by os.path.expanduser('~')).
        
is_absolute(self)

  True if the path is absolute (has both a root and, if applicable,
          a drive).
is_block_device(self)


          Whether this path is a block device.
        
is_char_device(self)


          Whether this path is a character device.
        
is_dir(self)


          Whether this path is a directory.
        
is_fifo(self)


          Whether this path is a FIFO.
        
is_file(self)


          Whether this path is a regular file (also True for symlinks pointing
          to regular files).
        
is_mount(self)


          Check if this path is a POSIX mount point
        
is_relative_to(self, *other)

  Return True if the path is relative to another path or False.
        
is_reserved(self)

  Return True if the path contains one of the special names reserved
          by the system, if any.
is_socket(self)


          Whether this path is a socket.
        
is_symlink(self)


          Whether this path is a symbolic link.
        
iterdir(self)

  Iterate over the files in this directory.  Does not yield any
          result for the special paths '.' and '..'.
        
joinpath(self, *args)

  Combine this path with one or several arguments, and return a
          new path representing either a subpath (if all arguments are relative
          paths) or a totally different path (if one of the arguments is
          anchored).
        
lchmod(self, mode)


          Like chmod(), except if the path points to a symlink, the symlink's
          permissions are changed, rather than its target's.
        
link_to(self, target)


          Make the target path a hard link pointing to this path.

          Note this function does not make this path a hard link to *target*,
          despite the implication of the function and argument names. The order
          of arguments (target, link) is the reverse of Path.symlink_to, but
          matches that of os.link.

          Deprecated since Python 3.10 and scheduled for removal in Python 3.12.
          Use `hardlink_to()` instead.
        
lstat(self)


          Like stat(), except if the path points to a symlink, the symlink's
          status information is returned, rather than its target's.
        
match(self, path_pattern)


          Return True if this path matches the given pattern.
        
mkdir(self, mode=511, parents=False, exist_ok=False)


          Create a new directory at this given path.
        
open(self, mode='r', buffering=-1, encoding=None, errors=None, newline=None)


          Open the file pointed by this path and return a file object, as
          the built-in open() function does.
        
owner(self)


          Return the login name of the file owner.
        
read_bytes(self)


          Open the file in bytes mode, read it, and close the file.
        
read_text(self, encoding=None, errors=None)


          Open the file in text mode, read it, and close the file.
        
readlink(self)


          Return the path to which the symbolic link points.
        
relative_to(self, *other)

  Return the relative path to another path identified by the passed
          arguments.  If the operation is not possible (because this is not
          a subpath of the other path), raise ValueError.
        
rename(self, target)


          Rename this path to the target path.

          The target path may be absolute or relative. Relative paths are
          interpreted relative to the current working directory, *not* the
          directory of the Path object.

          Returns the new Path instance pointing to the target path.
        
replace(self, target)


          Rename this path to the target path, overwriting if that path exists.

          The target path may be absolute or relative. Relative paths are
          interpreted relative to the current working directory, *not* the
          directory of the Path object.

          Returns the new Path instance pointing to the target path.
        
resolve(self, strict=False)


          Make the path absolute, resolving all symlinks on the way and also
          normalizing it (for example turning slashes into backslashes under
          Windows).
        
rglob(self, pattern)

  Recursively yield all existing files (of any kind, including
          directories) matching the given relative pattern, anywhere in
          this subtree.
        
rmdir(self)


          Remove this directory.  The directory must be empty.
        
samefile(self, other_path)

  Return whether other_path is the same or not as this file
          (as returned by os.path.samefile()).
        
stat(self, *, follow_symlinks=True)


          Return the result of the stat() system call on this path, like
          os.stat() does.
        
symlink_to(self, target, target_is_directory=False)


          Make this path a symlink pointing to the target path.
          Note the order of arguments (link, target) is the reverse of os.symlink.
        
touch(self, mode=438, exist_ok=True)


          Create this file with the given access mode, if it doesn't exist.
        
unlink(self, missing_ok=False)


          Remove this file or link.
          If the path is a directory, use rmdir() instead.
        
with_name(self, name)

  Return a new path with the file name changed.
with_stem(self, stem)

  Return a new path with the stem changed.
with_suffix(self, suffix)

  Return a new path with the file suffix changed.  If the path
          has no suffix, add given suffix.  If the given suffix is an empty
          string, remove the suffix from the path.
        
write_bytes(self, data)


          Open the file in bytes mode, write to it, and close the file.
        
write_text(self, data, encoding=None, errors=None, newline=None)


          Open the file in text mode, write to it, and close the file.
        
anchor = <property object at 0x7f75e2d070b0>
  The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010>
  The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100>
  The final path component, if any.
parent = <property object at 0x7f75e2d07290>
  The logical parent of the path.
parents = <property object at 0x7f75e2d072e0>
  A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240>
  An object providing sequence-like access to the
          components in the filesystem path.
root = <property object at 0x7f75e2d07060>
  The root of the path, if any.
stem = <property object at 0x7f75e2d071f0>
  The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150>

          The final component's last suffix, if any.

          This includes the leading period. For example: '.txt'
        
suffixes = <property object at 0x7f75e2d071a0>

          A list of the final component's suffixes, if any.

          These include the leading periods. For example: ['.tar', '.gz']
        

PosixPath

Path subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    
absolute(self)

  Return an absolute version of this path.  This function works
          even if the path doesn't point to anything.

          No normalization is done, i.e. all '.' and '..' will be kept along.
          Use resolve() to get the canonical path to a file.
        
as_posix(self)

  Return the string representation of the path with forward (/)
          slashes.
as_uri(self)

  Return the path as a 'file' URI.
chmod(self, mode, *, follow_symlinks=True)


          Change the permissions of the path, like os.chmod().
        
cwd()

  Return a new path pointing to the current working directory
          (as returned by os.getcwd()).
        
exists(self)


          Whether this path exists.
        
expanduser(self)

   Return a new path with expanded ~ and ~user constructs
          (as returned by os.path.expanduser)
        
glob(self, pattern)

  Iterate over this subtree and yield all existing files (of any
          kind, including directories) matching the given relative pattern.
        
group(self)


          Return the group name of the file gid.
        
hardlink_to(self, target)


          Make this path a hard link pointing to the same file as *target*.

          Note the order of arguments (self, target) is the reverse of os.link's.
        
home()

  Return a new path pointing to the user's home directory (as
          returned by os.path.expanduser('~')).
        
is_absolute(self)

  True if the path is absolute (has both a root and, if applicable,
          a drive).
is_block_device(self)


          Whether this path is a block device.
        
is_char_device(self)


          Whether this path is a character device.
        
is_dir(self)


          Whether this path is a directory.
        
is_fifo(self)


          Whether this path is a FIFO.
        
is_file(self)


          Whether this path is a regular file (also True for symlinks pointing
          to regular files).
        
is_mount(self)


          Check if this path is a POSIX mount point
        
is_relative_to(self, *other)

  Return True if the path is relative to another path or False.
        
is_reserved(self)

  Return True if the path contains one of the special names reserved
          by the system, if any.
is_socket(self)


          Whether this path is a socket.
        
is_symlink(self)


          Whether this path is a symbolic link.
        
iterdir(self)

  Iterate over the files in this directory.  Does not yield any
          result for the special paths '.' and '..'.
        
joinpath(self, *args)

  Combine this path with one or several arguments, and return a
          new path representing either a subpath (if all arguments are relative
          paths) or a totally different path (if one of the arguments is
          anchored).
        
lchmod(self, mode)


          Like chmod(), except if the path points to a symlink, the symlink's
          permissions are changed, rather than its target's.
        
link_to(self, target)


          Make the target path a hard link pointing to this path.

          Note this function does not make this path a hard link to *target*,
          despite the implication of the function and argument names. The order
          of arguments (target, link) is the reverse of Path.symlink_to, but
          matches that of os.link.

          Deprecated since Python 3.10 and scheduled for removal in Python 3.12.
          Use `hardlink_to()` instead.
        
lstat(self)


          Like stat(), except if the path points to a symlink, the symlink's
          status information is returned, rather than its target's.
        
match(self, path_pattern)


          Return True if this path matches the given pattern.
        
mkdir(self, mode=511, parents=False, exist_ok=False)


          Create a new directory at this given path.
        
open(self, mode='r', buffering=-1, encoding=None, errors=None, newline=None)


          Open the file pointed by this path and return a file object, as
          the built-in open() function does.
        
owner(self)


          Return the login name of the file owner.
        
read_bytes(self)


          Open the file in bytes mode, read it, and close the file.
        
read_text(self, encoding=None, errors=None)


          Open the file in text mode, read it, and close the file.
        
readlink(self)


          Return the path to which the symbolic link points.
        
relative_to(self, *other)

  Return the relative path to another path identified by the passed
          arguments.  If the operation is not possible (because this is not
          a subpath of the other path), raise ValueError.
        
rename(self, target)


          Rename this path to the target path.

          The target path may be absolute or relative. Relative paths are
          interpreted relative to the current working directory, *not* the
          directory of the Path object.

          Returns the new Path instance pointing to the target path.
        
replace(self, target)


          Rename this path to the target path, overwriting if that path exists.

          The target path may be absolute or relative. Relative paths are
          interpreted relative to the current working directory, *not* the
          directory of the Path object.

          Returns the new Path instance pointing to the target path.
        
resolve(self, strict=False)


          Make the path absolute, resolving all symlinks on the way and also
          normalizing it (for example turning slashes into backslashes under
          Windows).
        
rglob(self, pattern)

  Recursively yield all existing files (of any kind, including
          directories) matching the given relative pattern, anywhere in
          this subtree.
        
rmdir(self)


          Remove this directory.  The directory must be empty.
        
samefile(self, other_path)

  Return whether other_path is the same or not as this file
          (as returned by os.path.samefile()).
        
stat(self, *, follow_symlinks=True)


          Return the result of the stat() system call on this path, like
          os.stat() does.
        
symlink_to(self, target, target_is_directory=False)


          Make this path a symlink pointing to the target path.
          Note the order of arguments (link, target) is the reverse of os.symlink.
        
touch(self, mode=438, exist_ok=True)


          Create this file with the given access mode, if it doesn't exist.
        
unlink(self, missing_ok=False)


          Remove this file or link.
          If the path is a directory, use rmdir() instead.
        
with_name(self, name)

  Return a new path with the file name changed.
with_stem(self, stem)

  Return a new path with the stem changed.
with_suffix(self, suffix)

  Return a new path with the file suffix changed.  If the path
          has no suffix, add given suffix.  If the given suffix is an empty
          string, remove the suffix from the path.
        
write_bytes(self, data)


          Open the file in bytes mode, write to it, and close the file.
        
write_text(self, data, encoding=None, errors=None, newline=None)


          Open the file in text mode, write to it, and close the file.
        
anchor = <property object at 0x7f75e2d070b0>
  The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010>
  The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100>
  The final path component, if any.
parent = <property object at 0x7f75e2d07290>
  The logical parent of the path.
parents = <property object at 0x7f75e2d072e0>
  A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240>
  An object providing sequence-like access to the
          components in the filesystem path.
root = <property object at 0x7f75e2d07060>
  The root of the path, if any.
stem = <property object at 0x7f75e2d071f0>
  The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150>

          The final component's last suffix, if any.

          This includes the leading period. For example: '.txt'
        
suffixes = <property object at 0x7f75e2d071a0>

          A list of the final component's suffixes, if any.

          These include the leading periods. For example: ['.tar', '.gz']
        

PurePath

Base class for manipulating paths without I/O.

    PurePath represents a filesystem path and offers operations which
    don't imply any actual filesystem I/O.  Depending on your system,
    instantiating a PurePath will return either a PurePosixPath or a
    PureWindowsPath object.  You can also instantiate either of these classes
    directly, regardless of your system.
    
as_posix(self)

  Return the string representation of the path with forward (/)
          slashes.
as_uri(self)

  Return the path as a 'file' URI.
is_absolute(self)

  True if the path is absolute (has both a root and, if applicable,
          a drive).
is_relative_to(self, *other)

  Return True if the path is relative to another path or False.
        
is_reserved(self)

  Return True if the path contains one of the special names reserved
          by the system, if any.
joinpath(self, *args)

  Combine this path with one or several arguments, and return a
          new path representing either a subpath (if all arguments are relative
          paths) or a totally different path (if one of the arguments is
          anchored).
        
match(self, path_pattern)


          Return True if this path matches the given pattern.
        
relative_to(self, *other)

  Return the relative path to another path identified by the passed
          arguments.  If the operation is not possible (because this is not
          a subpath of the other path), raise ValueError.
        
with_name(self, name)

  Return a new path with the file name changed.
with_stem(self, stem)

  Return a new path with the stem changed.
with_suffix(self, suffix)

  Return a new path with the file suffix changed.  If the path
          has no suffix, add given suffix.  If the given suffix is an empty
          string, remove the suffix from the path.
        
anchor = <property object at 0x7f75e2d070b0>
  The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010>
  The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100>
  The final path component, if any.
parent = <property object at 0x7f75e2d07290>
  The logical parent of the path.
parents = <property object at 0x7f75e2d072e0>
  A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240>
  An object providing sequence-like access to the
          components in the filesystem path.
root = <property object at 0x7f75e2d07060>
  The root of the path, if any.
stem = <property object at 0x7f75e2d071f0>
  The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150>

          The final component's last suffix, if any.

          This includes the leading period. For example: '.txt'
        
suffixes = <property object at 0x7f75e2d071a0>

          A list of the final component's suffixes, if any.

          These include the leading periods. For example: ['.tar', '.gz']
        

PurePosixPath

PurePath subclass for non-Windows systems.

    On a POSIX system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    
as_posix(self)

  Return the string representation of the path with forward (/)
          slashes.
as_uri(self)

  Return the path as a 'file' URI.
is_absolute(self)

  True if the path is absolute (has both a root and, if applicable,
          a drive).
is_relative_to(self, *other)

  Return True if the path is relative to another path or False.
        
is_reserved(self)

  Return True if the path contains one of the special names reserved
          by the system, if any.
joinpath(self, *args)

  Combine this path with one or several arguments, and return a
          new path representing either a subpath (if all arguments are relative
          paths) or a totally different path (if one of the arguments is
          anchored).
        
match(self, path_pattern)


          Return True if this path matches the given pattern.
        
relative_to(self, *other)

  Return the relative path to another path identified by the passed
          arguments.  If the operation is not possible (because this is not
          a subpath of the other path), raise ValueError.
        
with_name(self, name)

  Return a new path with the file name changed.
with_stem(self, stem)

  Return a new path with the stem changed.
with_suffix(self, suffix)

  Return a new path with the file suffix changed.  If the path
          has no suffix, add given suffix.  If the given suffix is an empty
          string, remove the suffix from the path.
        
anchor = <property object at 0x7f75e2d070b0>
  The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010>
  The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100>
  The final path component, if any.
parent = <property object at 0x7f75e2d07290>
  The logical parent of the path.
parents = <property object at 0x7f75e2d072e0>
  A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240>
  An object providing sequence-like access to the
          components in the filesystem path.
root = <property object at 0x7f75e2d07060>
  The root of the path, if any.
stem = <property object at 0x7f75e2d071f0>
  The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150>

          The final component's last suffix, if any.

          This includes the leading period. For example: '.txt'
        
suffixes = <property object at 0x7f75e2d071a0>

          A list of the final component's suffixes, if any.

          These include the leading periods. For example: ['.tar', '.gz']
        

PureWindowsPath

PurePath subclass for Windows systems.

    On a Windows system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    
as_posix(self)

  Return the string representation of the path with forward (/)
          slashes.
as_uri(self)

  Return the path as a 'file' URI.
is_absolute(self)

  True if the path is absolute (has both a root and, if applicable,
          a drive).
is_relative_to(self, *other)

  Return True if the path is relative to another path or False.
        
is_reserved(self)

  Return True if the path contains one of the special names reserved
          by the system, if any.
joinpath(self, *args)

  Combine this path with one or several arguments, and return a
          new path representing either a subpath (if all arguments are relative
          paths) or a totally different path (if one of the arguments is
          anchored).
        
match(self, path_pattern)


          Return True if this path matches the given pattern.
        
relative_to(self, *other)

  Return the relative path to another path identified by the passed
          arguments.  If the operation is not possible (because this is not
          a subpath of the other path), raise ValueError.
        
with_name(self, name)

  Return a new path with the file name changed.
with_stem(self, stem)

  Return a new path with the stem changed.
with_suffix(self, suffix)

  Return a new path with the file suffix changed.  If the path
          has no suffix, add given suffix.  If the given suffix is an empty
          string, remove the suffix from the path.
        
anchor = <property object at 0x7f75e2d070b0>
  The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010>
  The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100>
  The final path component, if any.
parent = <property object at 0x7f75e2d07290>
  The logical parent of the path.
parents = <property object at 0x7f75e2d072e0>
  A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240>
  An object providing sequence-like access to the
          components in the filesystem path.
root = <property object at 0x7f75e2d07060>
  The root of the path, if any.
stem = <property object at 0x7f75e2d071f0>
  The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150>

          The final component's last suffix, if any.

          This includes the leading period. For example: '.txt'
        
suffixes = <property object at 0x7f75e2d071a0>

          A list of the final component's suffixes, if any.

          These include the leading periods. For example: ['.tar', '.gz']
        

Sequence

All the operations on a read-only sequence.

    Concrete subclasses must override __new__ or __init__,
    __getitem__, and __len__.
    
count(self, value)

  S.count(value) -> integer -- return number of occurrences of value
index(self, value, start=0, stop=None)

  S.index(value, [start, [stop]]) -> integer -- return first index of value.
             Raises ValueError if the value is not present.

             Supporting start and stop arguments is optional, but
             recommended.
        

WindowsPath

Path subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    
absolute(self)

  Return an absolute version of this path.  This function works
          even if the path doesn't point to anything.

          No normalization is done, i.e. all '.' and '..' will be kept along.
          Use resolve() to get the canonical path to a file.
        
as_posix(self)

  Return the string representation of the path with forward (/)
          slashes.
as_uri(self)

  Return the path as a 'file' URI.
chmod(self, mode, *, follow_symlinks=True)


          Change the permissions of the path, like os.chmod().
        
cwd()

  Return a new path pointing to the current working directory
          (as returned by os.getcwd()).
        
exists(self)


          Whether this path exists.
        
expanduser(self)

   Return a new path with expanded ~ and ~user constructs
          (as returned by os.path.expanduser)
        
glob(self, pattern)

  Iterate over this subtree and yield all existing files (of any
          kind, including directories) matching the given relative pattern.
        
group(self)


          Return the group name of the file gid.
        
hardlink_to(self, target)


          Make this path a hard link pointing to the same file as *target*.

          Note the order of arguments (self, target) is the reverse of os.link's.
        
home()

  Return a new path pointing to the user's home directory (as
          returned by os.path.expanduser('~')).
        
is_absolute(self)

  True if the path is absolute (has both a root and, if applicable,
          a drive).
is_block_device(self)


          Whether this path is a block device.
        
is_char_device(self)


          Whether this path is a character device.
        
is_dir(self)


          Whether this path is a directory.
        
is_fifo(self)


          Whether this path is a FIFO.
        
is_file(self)


          Whether this path is a regular file (also True for symlinks pointing
          to regular files).
        
is_mount(self)
is_relative_to(self, *other)

  Return True if the path is relative to another path or False.
        
is_reserved(self)

  Return True if the path contains one of the special names reserved
          by the system, if any.
is_socket(self)


          Whether this path is a socket.
        
is_symlink(self)


          Whether this path is a symbolic link.
        
iterdir(self)

  Iterate over the files in this directory.  Does not yield any
          result for the special paths '.' and '..'.
        
joinpath(self, *args)

  Combine this path with one or several arguments, and return a
          new path representing either a subpath (if all arguments are relative
          paths) or a totally different path (if one of the arguments is
          anchored).
        
lchmod(self, mode)


          Like chmod(), except if the path points to a symlink, the symlink's
          permissions are changed, rather than its target's.
        
link_to(self, target)


          Make the target path a hard link pointing to this path.

          Note this function does not make this path a hard link to *target*,
          despite the implication of the function and argument names. The order
          of arguments (target, link) is the reverse of Path.symlink_to, but
          matches that of os.link.

          Deprecated since Python 3.10 and scheduled for removal in Python 3.12.
          Use `hardlink_to()` instead.
        
lstat(self)


          Like stat(), except if the path points to a symlink, the symlink's
          status information is returned, rather than its target's.
        
match(self, path_pattern)


          Return True if this path matches the given pattern.
        
mkdir(self, mode=511, parents=False, exist_ok=False)


          Create a new directory at this given path.
        
open(self, mode='r', buffering=-1, encoding=None, errors=None, newline=None)


          Open the file pointed by this path and return a file object, as
          the built-in open() function does.
        
owner(self)


          Return the login name of the file owner.
        
read_bytes(self)


          Open the file in bytes mode, read it, and close the file.
        
read_text(self, encoding=None, errors=None)


          Open the file in text mode, read it, and close the file.
        
readlink(self)


          Return the path to which the symbolic link points.
        
relative_to(self, *other)

  Return the relative path to another path identified by the passed
          arguments.  If the operation is not possible (because this is not
          a subpath of the other path), raise ValueError.
        
rename(self, target)


          Rename this path to the target path.

          The target path may be absolute or relative. Relative paths are
          interpreted relative to the current working directory, *not* the
          directory of the Path object.

          Returns the new Path instance pointing to the target path.
        
replace(self, target)


          Rename this path to the target path, overwriting if that path exists.

          The target path may be absolute or relative. Relative paths are
          interpreted relative to the current working directory, *not* the
          directory of the Path object.

          Returns the new Path instance pointing to the target path.
        
resolve(self, strict=False)


          Make the path absolute, resolving all symlinks on the way and also
          normalizing it (for example turning slashes into backslashes under
          Windows).
        
rglob(self, pattern)

  Recursively yield all existing files (of any kind, including
          directories) matching the given relative pattern, anywhere in
          this subtree.
        
rmdir(self)


          Remove this directory.  The directory must be empty.
        
samefile(self, other_path)

  Return whether other_path is the same or not as this file
          (as returned by os.path.samefile()).
        
stat(self, *, follow_symlinks=True)


          Return the result of the stat() system call on this path, like
          os.stat() does.
        
symlink_to(self, target, target_is_directory=False)


          Make this path a symlink pointing to the target path.
          Note the order of arguments (link, target) is the reverse of os.symlink.
        
touch(self, mode=438, exist_ok=True)


          Create this file with the given access mode, if it doesn't exist.
        
unlink(self, missing_ok=False)


          Remove this file or link.
          If the path is a directory, use rmdir() instead.
        
with_name(self, name)

  Return a new path with the file name changed.
with_stem(self, stem)

  Return a new path with the stem changed.
with_suffix(self, suffix)

  Return a new path with the file suffix changed.  If the path
          has no suffix, add given suffix.  If the given suffix is an empty
          string, remove the suffix from the path.
        
write_bytes(self, data)


          Open the file in bytes mode, write to it, and close the file.
        
write_text(self, data, encoding=None, errors=None, newline=None)


          Open the file in text mode, write to it, and close the file.
        
anchor = <property object at 0x7f75e2d070b0>
  The concatenation of the drive and root, or ''.
drive = <property object at 0x7f75e2d07010>
  The drive prefix (letter or UNC path), if any.
name = <property object at 0x7f75e2d07100>
  The final path component, if any.
parent = <property object at 0x7f75e2d07290>
  The logical parent of the path.
parents = <property object at 0x7f75e2d072e0>
  A sequence of this path's logical parents.
parts = <property object at 0x7f75e2d07240>
  An object providing sequence-like access to the
          components in the filesystem path.
root = <property object at 0x7f75e2d07060>
  The root of the path, if any.
stem = <property object at 0x7f75e2d071f0>
  The final path component, minus its last suffix.
suffix = <property object at 0x7f75e2d07150>

          The final component's last suffix, if any.

          This includes the leading period. For example: '.txt'
        
suffixes = <property object at 0x7f75e2d071a0>

          A list of the final component's suffixes, if any.

          These include the leading periods. For example: ['.tar', '.gz']
        

attrgetter

attrgetter(attr, ...) --> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand.
After f = attrgetter('name'), the call f(r) returns r.name.
After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).
After h = attrgetter('name.first', 'name.last'), the call h(r) returns
(r.name.first, r.name.last).

Functions

S_ISBLK

S_ISBLK(...)

  S_ISBLK(mode) -> bool

  Return True if mode is from a block special device file.

S_ISCHR

S_ISCHR(...)

  S_ISCHR(mode) -> bool

  Return True if mode is from a character special device file.

S_ISDIR

S_ISDIR(...)

  S_ISDIR(mode) -> bool

  Return True if mode is from a directory.

S_ISFIFO

S_ISFIFO(...)

  S_ISFIFO(mode) -> bool

  Return True if mode is from a FIFO (named pipe).

S_ISLNK

S_ISLNK(...)

  S_ISLNK(mode) -> bool

  Return True if mode is from a symbolic link.

S_ISREG

S_ISREG(...)

  S_ISREG(mode) -> bool

  Return True if mode is from a regular file.

S_ISSOCK

S_ISSOCK(...)

  S_ISSOCK(mode) -> bool

  Return True if mode is from a socket.

urlquote_from_bytes

quote_from_bytes(bs, safe='/')

  Like quote(), but accepts a bytes object rather than a str, and does
      not perform string-to-bytes encoding.  It always returns an ASCII string.
      quote_from_bytes(b'abc def?') -> 'abc%20def%3f'
    

Other members

EBADF = 9
EINVAL = 22
ELOOP = 40
ENOENT = 2
ENOTDIR = 20

Modules

fnmatch

functools

io

ntpath

os

posixpath

re

sys

warnings