diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2014-12-30 20:54:45 +0100 |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-12-30 20:54:45 +0100 |
| commit | 8477ed60486a22f79f257ee49f0bc18d0e73f216 (patch) | |
| tree | 0773c8950642ce61e1fd801cf39f4d5c557f5774 /Doc/library | |
| parent | 864d57c24452f78f2fcfb557caada47502619b39 (diff) | |
| download | cpython-git-8477ed60486a22f79f257ee49f0bc18d0e73f216.tar.gz | |
Issue #19776: Add a expanduser() method on Path objects.
Patch by Serhiy.
Diffstat (limited to 'Doc/library')
| -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 0942b21df3..c796cf4360 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 |
