On this page
ntpath.splitroot
Prev: ntpath.splitext | Up: ntpath
Rel: ntpath.abspath, ntpath.basename, ntpath.commonpath, ntpath.commonprefix
Ref: docs.python.org — ntpath.splitroot
Tags: #public #python3 #stdlib #ntpath
Import
import ntpath
from ntpath import splitroot
Signature & Overview
ntpath.splitroot(p)
Split a pathname into drive, root and tail.
Usage
import ntpath
if hasattr(ntpath, 'splitroot'):
assert ntpath.splitroot(r'C:\Users\Ada') == ('C:', '\\', r'Users\Ada')
Gotchas
- Requires Python 3.12+: Splits into
(drive, root, tail).
REPL Inspect
from ntpath import splitroot
help(splitroot)
Linked from
Related notes
- tuts/python3/stdlib_module/ntpath/splitext Linked here; links to this page; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ntpath/abspath Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/basename Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/commonpath Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/commonprefix Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/dirname shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/exists shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/expanduser shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/expandvars shared tags: #ntpath, #stdlib