当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python pathlib.PurePath.anchor用法及代码示例


用法:

PurePath.anchor

驱动器和根的串联:

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

相关用法


注:本文由纯净天空筛选整理自python.org大神的英文原创作品 pathlib.PurePath.anchor。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。