ID EN
Pathlib

joinpath

Python 3.11 🇮🇩 Bahasa Indonesia

Memanggil metode ini sama dengan menggabungkan jalur dengan masing-masing segmen jalur tertentu secara bergantian:

Syntax

PYTHON
PurePath.joinpath(*other)

Contoh

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')