On this page
posixpath.realpath
Prev: posixpath.normpath | Up: posixpath | Next: posixpath.relpath
Rel: posixpath.abspath, posixpath.basename, posixpath.commonpath, posixpath.commonprefix
Ref: docs.python.org — posixpath.realpath
Tags: #public #python3 #stdlib #posixpath
Import
import posixpath
from posixpath import realpath
Signature & Overview
posixpath.realpath(filename, *, strict=False)
Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path.
Usage
import posixpath
assert posixpath.isabs(posixpath.realpath('.'))
Gotchas
- Resolves all symlinks: Pass
strict=True(Python 3.10+) to fail if the path doesn't exist.
REPL Inspect
from posixpath import realpath
help(realpath)
Linked from
Related notes
- tuts/python3/stdlib_module/posixpath/normpath Linked here; links to this page; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/relpath Linked here; links to this page; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/posixpath/abspath Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/basename Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/commonpath Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/commonprefix Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/dirname shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/exists shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/expanduser shared tags: #posixpath, #stdlib