Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ we also call *flavours*:
>>> PurePath(Path('foo'), Path('bar'))
PurePosixPath('foo/bar')

When *pathsegments* is empty, the current directory is assumed::
When *pathsegments* is empty or consists only of empty strings,
the current directory is assumed::

>>> PurePath()
PurePosixPath('.')
>>> PurePath(), PurePath('')
(PurePosixPath('.'), PurePosixPath('.'))

If a segment is an absolute path, all previous segments are ignored
(like :func:`os.path.join`)::
Expand Down Expand Up @@ -1040,15 +1041,17 @@ Querying file type and status

.. method:: Path.exists(*, follow_symlinks=True)

Return ``True`` if the path points to an existing file or directory.
``False`` will be returned if the path is invalid, inaccessible or missing.
Return ``True`` if the path points to an existing file or directory and
``False`` if the path is invalid, inaccessible or missing.
Use :meth:`Path.stat` to distinguish between these cases.

This method normally follows symlinks; to check if a symlink exists, add
the argument ``follow_symlinks=False``.

::

>>> Path('').exists() # The current directory.
True
>>> Path('.').exists()
True
>>> Path('setup.py').exists()
Expand Down
Loading