The ntpath module

This module provides os.path functionality on Windows platforms. You can also use it if you need to handle Windows paths on other platforms.

Example: Using the ntpath module
# File: ntpath-example-1.py

import ntpath

file = "/my/little/pony"

print "isabs", "=>", ntpath.isabs(file)
print "dirname", "=>", ntpath.dirname(file)
print "basename", "=>", ntpath.basename(file)
print "normpath", "=>", ntpath.normpath(file)
print "split", "=>", ntpath.split(file)
print "join", "=>", ntpath.join(file, "zorba")

isabs => 1
dirname => /my/little
basename => pony
normpath => \my\little\pony
split => ('/my/little', 'pony')
join => /my/little/pony\zorba

Note that this module treats both forward slashes (/) and backward slashes (\) as directory separators.

 

A Django site. rendered by a django application. hosted by webfaction.