What is the correct cross-platform way to get the home directory in Python?
You want to use os.path.expanduser.This will ensure it works on all platforms: If you’re on Python 3.5+ you can use pathlib.Path.home():
You want to use os.path.expanduser.This will ensure it works on all platforms: If you’re on Python 3.5+ you can use pathlib.Path.home():