February 2006
Intermediate to advanced
648 pages
14h 53m
English
The os.path module is used to manipulate pathnames in a portable manner. It’s imported by the os module.
abspath(path)Returns an absolute version of the pathname path, taking the current working directory into account. For example, abspath('../Python/foo') might return '/home/beazley/Python/foo'.
basename(path)Returns the base name of pathname path. For example, basename('/usr/local/python') returns 'python'.
commonprefix(list)Returns the longest string that’s a prefix of all strings in list. If list is empty, the empty string is returned.
dirname(path)Returns the directory name of pathname path. For example, dirname('/usr/local/python') returns '/usr/local'.
exists(path)Returns True if path refers to an existing path. Returns
Read now
Unlock full access