Module ntpath |
[hide private]
[frames] | no frames]

# Module ntpath

source code

Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this module as os.path.

Functions | [hide private]
abspath(path) Return the absolute version of a path. | source code
basename(p) Returns the final component of a pathname | source code
commonprefix(m) Given a list of pathnames, returns the longest common leading component | source code
dirname(p) Returns the directory component of a pathname | source code
exists(path) Test whether a path exists | source code
expanduser(path) Expand ~ and ~user constructs. | source code
expandvars(path) Expand shell variables of form $var and ${var}. | source code
getatime(filename) Return the last access time of a file, reported by os.stat() | source code
getctime(filename) Return the creation time of a file, reported by os.stat(). | source code
getmtime(filename) Return the last modification time of a file, reported by os.stat() | source code
getsize(filename) Return the size of a file, reported by os.stat() | source code
isabs(s) Test whether a path is absolute | source code
isdir(path) Test whether a path is a directory | source code
isfile(path) Test whether a path is a regular file | source code
islink(path) Test for symbolic link. | source code
ismount(path) Test whether a path is a mount point (defined as root of drive) | source code
join(a, *p) Join two or more pathname components, inserting "\" as needed | source code
lexists(path) Test whether a path exists | source code
normcase(s) Normalize case of pathname. | source code
normpath(path) Normalize path, eliminating double slashes, etc. | source code
realpath(path) Return the absolute version of a path. | source code
split(p) Split a pathname. | source code
splitdrive(p) Split a pathname into drive and path specifiers. | source code
splitext(p) Split the extension from a pathname. | source code
splitunc(p) Split a pathname into UNC mount point and relative path specifiers. | source code
walk(top, func, arg) Directory tree walk with callback function. | source code

Variables | [hide private]
| altsep = ``'``/``'``
| curdir = ``'``.``'``
| defpath = ``'``.;C:\\bin``'``
| devnull = ``'``nul``'``
| extsep = ``'``.``'``
| pardir = ``'``..``'``
| pathsep = ``'``;``'``
| sep = ``'``\\``'``
| supports_unicode_filenames = `False`

Imports: ntpath._getfullpathname, os, stat, sys

Function Details | [hide private]

### expanduser(path) | source code
Expand ~ and ~user constructs. If user or $HOME is unknown, do nothing.

### expandvars(path) | source code
Expand shell variables of form $var and ${var}. Unknown variables are left unchanged.

### islink(path) | source code
Test for symbolic link. On WindowsNT/95 always returns false

### normcase(s) | source code
Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes.

### split(p) | source code
Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.

### splitdrive(p) | source code
Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty

### splitext(p) | source code
Split the extension from a pathname. Extension is everything from the last dot to the end. Return (root, ext), either part may be empty.

### splitunc(p) | source code
Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have an UNC part.

### walk(top, func, arg) | source code
Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.