May 2001
Intermediate to advanced
304 pages
6h 12m
English
The posixpath module, shown in Example 13-4, provides os.path functionality on
Unix and other POSIX-compatible platforms. You can also use it to handle POSIX paths on other platforms. In addition, it can be used to
process URLs.
Example 13-4. Using the posixpath Module
File: posixpath-example-1.py import posixpath file = "/my/little/pony" print "isabs", "=>", posixpath.isabs(file) print "dirname", "=>", posixpath.dirname(file) print "basename", "=>", posixpath.basename(file) print "normpath", "=>", posixpath.normpath(file) print "split", "=>", posixpath.split(file) print "join", "=>", posixpath.join(file, "zorba")isabs => 1dirname => /my/littlebasename => ponynormpath => /my/little/ponysplit => ('/my/little', 'pony')join => /my/little/pony/zorba
Read now
Unlock full access