How to create a file on users XP desktop

Scott David Daniels Scott.Daniels at Acm.Org
Sun Oct 7 01:24:49 EDT 2007


goldtech wrote:
> ... I want the new file's location to be on the user's desktop in 
> a Windows XP environment....
> 
How about:
     import os.path
     handle = open(os.path.expanduser(r'~\DeskTop\somefile.txt'), 'w')
     ...

-Scott



More information about the Python-list mailing list