os.path.dirname returns the directory portion of a filesystem pathname, excluding its final file or directory name. section 12.2.4
Extract a directory
For `some/directory/path.jpg`, `os.path.dirname` returns `'some/directory'`. Use `os.path.basename` when you need the final component instead.
Related pathname operations separate complementary parts:
- `os.path.split` returns the directory portion and basename as a two-element tuple. section 12.2.4
- `os.path.splitext` separates a pathname from its dotted extension. section 12.2.4
