How to create a file on users XP desktop
goldtech at worldpost.com
Sun Oct 7 13:58:46 CEST 2007
> This is really a Windows question, not a Python question. You should
> have been able to figure it out yourself by examining existing
> environment variables.
I agree, you're right. I learn more by figuring out the code myself.
After Google briefly: In a DOS box type: SET
This was too easy - sorry.
> Something like the code below should work for you if the standard
> environment variables haven't been hosed.
> import os
> Filename = os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH") + "\\Desktop
> f = file(Filename, "w")
> f.write("Here's a file on the desktop\n")
More information about the Python-list