How to create a file on users XP desktop

Scott David Daniels Scott.Daniels at Acm.Org
Sun Oct 7 07:24:49 CEST 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')


More information about the Python-list mailing list