(path)
return path
Return the path with the $HOME prefix shortened to '~/' if applicable.

    Example
    -------
    >>> prettyfypath("/home/user/file.dat")
    '~/file.dat'
Return the path with the $HOME prefix shortened to '~/' if applicable.
Return the path with the $HOME prefix shortened to ~ / if applicable .
def prettyfypath(path):
    """
    Return the path with the $HOME prefix shortened to '~/' if applicable.

    Example
    -------
    >>> prettyfypath("/home/user/file.dat")
    '~/file.dat'
    """
    home = os.path.expanduser("~/")
    home_n = pathnormalize(home)
    path_n = pathnormalize(path)
    if path_n.startswith(home_n):
        path = os.path.join("~", os.path.relpath(path, home))
    return path
def prettyfypath ( path ) : home = os . path . expanduser ( "~/" ) home_n = pathnormalize ( home ) path_n = pathnormalize ( path ) if path_n . startswith ( home_n ) : path = os . path . join ( "~" , os . path . relpath ( path , home ) ) return path