ID EN
Pathlib

anchor

Python 3.11

The concatenation of the drive and root:

Syntax

PYTHON
PurePath.anchor

Examples

Example 1
PYTHON
>>> PureWindowsPath('c:/Program Files/').anchor
'c:\\'
>>> PureWindowsPath('c:Program Files/').anchor
'c:'
>>> PurePosixPath('/etc').anchor
'/'
>>> PureWindowsPath('//host/share').anchor
'\\\\host\\share\\'