HOME Directory in posix and nt

Jeff Epler jepler at unpythonic.net
Sun Aug 3 11:49:23 EDT 2003


os.environ holds the system environment, so
	home = os.environ['HOME'] 
on unix, and 
	home = os.environ['HOMEPATH'] 
on windows might be what you want.

You could also try
	home = os.path.expanduser("~")
which looks at HOME and pwd.getpwuid on unix, and at HOME, HOMEPATH, and
HOMEDRIVE on NT.

Jeff





More information about the Python-list mailing list