Skip to content

Instantly share code, notes, and snippets.

@PhazeonPhoenix
Created September 20, 2012 17:06
Show Gist options
  • Save PhazeonPhoenix/3757095 to your computer and use it in GitHub Desktop.
Save PhazeonPhoenix/3757095 to your computer and use it in GitHub Desktop.
Get user's home path in *nix and Windows
import os
if "HOME" in os.environ:
myhome = os.environ['HOME']
elif "HOMEPATH" in os.environ:
myhome = os.path.join(os.environ['HOMEDRIVE'], os.environ['HOMEPATH'])
print myhome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment