You could use this: import os fp = open(os.path.expanduser('~')+r'\Desktop\myFile', 'r')
Light > In python under windows, how can I create and access a file on the > Desktop? The following do NOT work: fp = open(r'Desktop\myFile','r') > fp = open(r'\Desktop\myFile','r') > fp = open(r'c:\Desktop\myFile','r') > fp = open(r'c:\Windows\Desktop\myFile','r') > > I don't want to drill into c:\Documents and Setting\... because the > user name is often obscure AND not all desktop files appear in the > same subdir. of that. For example some are in 'All Users" or 'Default > User'. > > Michael Huster, > Simpson University > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor