What is a shortcut to the Default home directory in Windows

Christian Heimes lists at cheimes.de
Fri Jan 18 15:29:13 EST 2008


Daniel Folkes wrote:
> I am trying to write a file to the users file system.
> 
> I need it to be in there home directory in WINDOWS.  I know there is a
> "shortcut" to home in Linux("~"), but is there an equivalent to that
> in windows.  Or to get to their "Documents and Settings" directory?
> 
> Thanks in advance for the help.

os.path.expanduser("~") works on Windows, too. For application related
data like config files please use os.environ["APPDATA"]. For all
remaining shell folders like My Documents you *have* to use the win32
api. All shell folder names are localized and depend on the language
version.

Christian




More information about the Python-list mailing list