ID EN
Pathlib

joinpath

Python 3.11

Calling this method is equivalent to combining the path with each of the other arguments in turn:

Syntax

PYTHON
PurePath.joinpath(*other)

Examples

Example 1
PYTHON
>>> PurePosixPath('/etc').joinpath('passwd')
PurePosixPath('/etc/passwd')
>>> PurePosixPath('/etc').joinpath(PurePosixPath('passwd'))
PurePosixPath('/etc/passwd')
>>> PurePosixPath('/etc').joinpath('init.d', 'apache2')
PurePosixPath('/etc/init.d/apache2')
>>> PureWindowsPath('c:').joinpath('/Program Files')
PureWindowsPath('c:/Program Files')