How to get the path of home directory in windows?
I have the script that write log.txt in my windows 7 Desktop.
How can I change path in python to write log.txt in homedir directory? Is there any way to do it?
I tried with those 2 methods But its not work and its still write on windows Desktop?
LOG_FILENAME = 'log.txt' #Method1 homedir = os.environ['ALLUSERSPROFILE'] LOG_FILENAME = homedir LOG_FILENAME = 'log.txt' #Method 2 homedir = os.path.expanduser('~') LOG_FILENAME = homedir LOG_FILENAME = 'log.txt' #http://snipplr.com/view.php?codeview&id=7354
Edited 3 Years Ago by tony75