diff options
author | Girts <girtsf@users.noreply.github.com> | 2019-10-23 21:18:40 (GMT) |
---|---|---|
committer | Miss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-10-23 21:18:40 (GMT) |
commit | a01ba333affcc0677146dc8af57179bdb808d608 (patch) | |
tree | 5b3c67ab51bc2c5074b19828c24de7a3d2eac119 /Doc/library/pathlib.rst | |
parent | 01659ca62c4508518478a74615ac91c0009427ad (diff) | |
download | cpython-a01ba333affcc0677146dc8af57179bdb808d608.zip cpython-a01ba333affcc0677146dc8af57179bdb808d608.tar.gz cpython-a01ba333affcc0677146dc8af57179bdb808d608.tar.bz2 |
bpo-30618: add readlink to pathlib.Path (GH-8285)
This adds a "readlink" method to pathlib.Path objects that calls through
to os.readlink.
https://bugs.python.org/issue30618
Automerge-Triggered-By: @gpshead
Diffstat (limited to 'Doc/library/pathlib.rst')
-rw-r--r-- | Doc/library/pathlib.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index acbd0e4..5906a33 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -944,6 +944,19 @@ call fails (for example because the path doesn't exist). .. versionadded:: 3.5 +.. method:: Path.readlink() + + Return the path to which the symbolic link points (as returned by + :func:`os.readlink`):: + + >>> p = Path('mylink') + >>> p.symlink_to('setup.py') + >>> p.readlink() + PosixPath('setup.py') + + .. versionadded:: 3.9 + + .. method:: Path.rename(target) Rename this file or directory to the given *target*, and return a new Path @@ -1153,6 +1166,7 @@ os and os.path pathlib :func:`os.path.isdir` :meth:`Path.is_dir` :func:`os.path.isfile` :meth:`Path.is_file` :func:`os.path.islink` :meth:`Path.is_symlink` +:func:`os.readlink` :meth:`Path.readlink` :func:`os.stat` :meth:`Path.stat`, :meth:`Path.owner`, :meth:`Path.group` |