Python ntpath Module
Example
Work with Windows-style paths (basename):
import ntpath
print(ntpath.basename("C:/Users/Emil/file.txt"))
Try it Yourself »
Definition and Usage
The ntpath module implements os.path on Windows (path operations for NT/Win32).
Use it to manipulate Windows paths: join, split, normalize, and extract components.
Members
Member | Description |
---|---|
basename() | Return the base name of pathname. |
dirname() | Return the directory name of pathname. |
join() | Join one or more path components intelligently. |
splitext() | Split the pathname into root and extension. |