Wednesday, January 6, 2010 at 2:20 am
Python: abspath, basename, dirname
This is a note-to-self post regarding three of Python’s os.path functions, some examples:
>>> os.path.abspath('/opt/stuff/things/bin')
'/opt/stuff/things/bin'
>>> os.path.abspath('stuff/things/bin')
'/opt/stuff/things/bin'
>>> os.path.basename('/opt/stuff/things/bin')
'bin'
>>> os.path.dirname('/opt/stuff/things/bin')
'/opt/stuff/things'

