Remove this directory. The directory must be empty.
-Other methods
-^^^^^^^^^^^^^
-
-.. classmethod:: Path.cwd()
-
- Return a new path object representing the current directory (as returned
- by :func:`os.getcwd`)::
-
- >>> Path.cwd()
- PosixPath('/home/antoine/pathlib')
-
+Ownership and permissions
+^^^^^^^^^^^^^^^^^^^^^^^^^
-.. classmethod:: Path.home()
+.. method:: Path.owner()
- Return a new path object representing the user's home directory (as
- returned by :func:`os.path.expanduser` with ``~`` construct). If the home
- directory can't be resolved, :exc:`RuntimeError` is raised.
+ Return the name of the user owning the file. :exc:`KeyError` is raised
+ if the file's user identifier (UID) isn't found in the system database.
- ::
- >>> Path.home()
- PosixPath('/home/antoine')
+.. method:: Path.group()
- .. versionadded:: 3.5
+ Return the name of the group owning the file. :exc:`KeyError` is raised
+ if the file's group identifier (GID) isn't found in the system database.
.. method:: Path.chmod(mode, *, follow_symlinks=True)
The *follow_symlinks* parameter was added.
-.. method:: Path.expanduser()
+.. method:: Path.lchmod(mode)
- Return a new path with expanded ``~`` and ``~user`` constructs,
- as returned by :meth:`os.path.expanduser`. If a home directory can't be
- resolved, :exc:`RuntimeError` is raised.
+ Like :meth:`Path.chmod` but, if the path points to a symbolic link, the
+ symbolic link's mode is changed rather than its target's.
- ::
- >>> p = PosixPath('~/films/Monty Python')
- >>> p.expanduser()
- PosixPath('/home/eric/films/Monty Python')
+Other methods
+^^^^^^^^^^^^^
- .. versionadded:: 3.5
+.. classmethod:: Path.cwd()
+ Return a new path object representing the current directory (as returned
+ by :func:`os.getcwd`)::
-.. method:: Path.group()
+ >>> Path.cwd()
+ PosixPath('/home/antoine/pathlib')
- Return the name of the group owning the file. :exc:`KeyError` is raised
- if the file's gid isn't found in the system database.
+.. classmethod:: Path.home()
-.. method:: Path.lchmod(mode)
+ Return a new path object representing the user's home directory (as
+ returned by :func:`os.path.expanduser` with ``~`` construct). If the home
+ directory can't be resolved, :exc:`RuntimeError` is raised.
- Like :meth:`Path.chmod` but, if the path points to a symbolic link, the
- symbolic link's mode is changed rather than its target's.
+ ::
+
+ >>> Path.home()
+ PosixPath('/home/antoine')
+ .. versionadded:: 3.5
-.. method:: Path.owner()
- Return the name of the user owning the file. :exc:`KeyError` is raised
- if the file's uid isn't found in the system database.
+.. method:: Path.expanduser()
+
+ Return a new path with expanded ``~`` and ``~user`` constructs,
+ as returned by :meth:`os.path.expanduser`. If a home directory can't be
+ resolved, :exc:`RuntimeError` is raised.
+
+ ::
+
+ >>> p = PosixPath('~/films/Monty Python')
+ >>> p.expanduser()
+ PosixPath('/home/eric/films/Monty Python')
+
+ .. versionadded:: 3.5
.. method:: Path.readlink()