def split_dir_base_ext(path):
    """Split a path into a 3-tuple containing dirname, filename sans
    extension, and extension.
    >>> split_dir_base_ext('/foo/bar/biz.txt')
    ('/foo/bar', 'biz', '.txt')
    >>> split_dir_base_ext('.txt')
    ('', '', '.txt')
    """
    dn = os.path.dirname(path)
    name, ext = os.path.splitext(os.path.basename(path))
    return dn, name, ext
Split a path into a 3-tuple containing dirname, filename sans
    extension, and extension.
    >>> split_dir_base_ext('/foo/bar/biz.txt')
    ('/foo/bar', 'biz', '.txt')
    >>> split_dir_base_ext('.txt')
    ('', '', '.txt')
    
recipes/Python/442517_Fix_ugly_file_names_be_UNIX/recipe-442517.py