Both functions use the os.path.split(path) function to split the path path into a pair; (head, tail) .
The os.path.dirname(path) function returns the beginning of the path.
For example: dirname '/foo/bar/item' - '/foo/bar' .
The os.path.basename(path) function returns the tail of a path.
For example: Base name '/foo/bar/item' returns 'item'
From: http://docs.python.org/2/library/os.path.html#os.path.basename
Breno Teixeira Mar 08 '14 at 16:35 2014-03-08 16:35
source share