diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-12-30 19:54:45 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-12-30 19:54:45 (GMT) |
commit | 8477ed60486a22f79f257ee49f0bc18d0e73f216 (patch) | |
tree | 0773c8950642ce61e1fd801cf39f4d5c557f5774 /Doc/library/pathlib.rst | |
parent | 864d57c24452f78f2fcfb557caada47502619b39 (diff) | |
download | cpython-8477ed60486a22f79f257ee49f0bc18d0e73f216.zip cpython-8477ed60486a22f79f257ee49f0bc18d0e73f216.tar.gz cpython-8477ed60486a22f79f257ee49f0bc18d0e73f216.tar.bz2 |
Issue #19776: Add a expanduser() method on Path objects.
Patch by Serhiy.
Diffstat (limited to 'Doc/library/pathlib.rst')
-rw-r--r-- | Doc/library/pathlib.rst | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 0942b21..c796cf4 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -670,6 +670,18 @@ call fails (for example because the path doesn't exist): symlink *points to* an existing file or directory. +.. method:: Path.expanduser() + + Return a new path with expanded ``~`` and ``~user`` constructs, + as returned by :meth:`os.path.expanduser`:: + + >>> p = PosixPath('~/films/Monty Python') + >>> p.expanduser() + PosixPath('/home/eric/films/Monty Python') + + .. versionadded:: 3.5 + + .. method:: Path.glob(pattern) Glob the given *pattern* in the directory represented by this path, @@ -1003,7 +1015,4 @@ call fails (for example because the path doesn't exist): >>> p.read_text() 'Text file contents' - An existing file of the same name is overwritten. The optional parameters - have the same meaning as in :func:`open`. - .. versionadded:: 3.5 |