(p)
return head
Returns the directory component of a pathname
Returns the directory component of a pathname
Returns the directory component of a pathname
def dirname(p):
    """Returns the directory component of a pathname"""
    p = os.fspath(p)
    sep = _get_sep(p)
    i = p.rfind(sep) + 1
    head = p[:i]
    if head and head != sep*len(head):
        head = head.rstrip(sep)
    return head
def dirname ( p ) : p = os . fspath ( p ) sep = _get_sep ( p ) i = p . rfind ( sep ) + 1 head = p [ : i ] if head and head != sep * len ( head ) : head = head . rstrip ( sep ) return head