On this page
ntpath.splitdrive
Prev: ntpath.split | Up: ntpath | Next: ntpath.splitext
Rel: ntpath.abspath, ntpath.basename, ntpath.commonpath, ntpath.commonprefix
Ref: docs.python.org — ntpath.splitdrive
Tags: #public #python3 #stdlib #ntpath
Import
import ntpath
from ntpath import splitdrive
Signature & Overview
ntpath.splitdrive(p)
Split a pathname into drive/UNC sharepoint and relative path specifiers.
Usage
import ntpath
assert ntpath.splitdrive(r'C:\a\b') == ('C:', r'\a\b')
assert ntpath.splitdrive(r'\\srv\share\f') == (r'\\srv\share', r'\f')
Gotchas
- Handles both drive letters (
C:) and UNC shares (\\host\share).
REPL Inspect
from ntpath import splitdrive
help(splitdrive)
Linked from
Related notes
- tuts/python3/stdlib_module/ntpath/split Linked here; links to this page; shared tags: #ntpath, #stdlib
- 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