Path.resolve()
Make the path absolute, resolving any symlinks. A new path object is returned:
1 2 3 4 5 | >>> p = Path() >>> p PosixPath( '.' ) >>> p.resolve() PosixPath( '/home/antoine/pathlib' ) |
”..” components are also eliminated (this is the only method to do so):
1 2 3 | >>> p = Path( 'docs/../setup.py' ) >>> p.resolve() PosixPath( '/home/antoine/pathlib/setup.py' ) |
If the path doesn’t exist, FileNotFoundError
is raised. If an infinite loop is encountered along the resolution path, RuntimeError
is raised.
Please login to continue.