User Home Dir
os.path
You want to use os.path.expanduser.
This will ensure it works on all platforms:
pathlib.Path
If you're on Python 3.5+ you can use pathlib.Path.home():
But it's usually better not to convert Path.home()
to string. It's more natural to use this way:
Last updated