Created
September 20, 2012 17:06
-
-
Save PhazeonPhoenix/3757095 to your computer and use it in GitHub Desktop.
Get user's home path in *nix and Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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