[code.view]

[top] / python / PyMOTW / ospath / ospath_split.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """Separate a path into its directory and base components.
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import os.path
     
     for path in [ '/one/two/three', 
                   '/one/two/three/',
                   '/',
                   '.',
                   '']:
         print '"%s" : "%s"' % (path, os.path.split(path))

[top] / python / PyMOTW / ospath / ospath_split.py

contact | logmethods.com