ID EN
OS Path

expanduser

Python 3.11

On Unix and Windows, return the argument with an initial component of ~ or ~user replaced by that user’s home directory.

Syntax

PYTHON
os.path.expanduser(path)

See Also

pwd path-like object