How to create a file on users XP desktop

Josh Bloom joshbloom at gmail.com
Sun Oct 7 00:22:47 EDT 2007


I believe you can use something like '%USERPROFILE%\DESKTOP' as the path on
a windows machine to get to the current users desktop directory. I'm not
sure if the python open() command will expand that correctly, but give it a
shot.

-Josh


On 10/6/07, goldtech <goldtech at worldpost.com> wrote:
>
> Can anyone link me or explain the following:
>
> I open a file in a python script. I want the new file's location to be
> on the user's desktop in a Windows XP environment.  fileHandle = open
> (....., 'w' )  what I guess I'm looking for is an environmental
> variable that will usually be correct on most XP desktops and will
> work in the open statement. Or is there another way?
>
> Thanks
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071006/d0070e81/attachment.html>


More information about the Python-list mailing list