`unexpanduser` counterpart to `os.path.expanduser`
Discussions on Python.org
`unexpanduser` counterpart to `os.path.expanduser`
Hey. Would there be any interest in adding a counterpart for `os.path.expanduser` like: def unexpanduser(path): home_directory = os.path.expanduser("~") if os.path.isabs(home_directory) and os.path.isabs(path) and os.path.commonpath((home_directory, path)) == home_directory: relative_path = os.path.relpath(path, start=home_directory) return "~" if relative_path == "." else os.path.join("~", relative_path) else: return path I need this from time to tim...
0 comments
No comments yet.