On Sun, 19 Jun 2011 23:00:38 -0700, Tim Hanson wrote: > This works: > infile=open('/foo/bar/prog/py_modules/this_is_a_test','r') > > This doesn't: > infile=open('~/prog/py_modules/this_is_a_test','r') > > Can't I work with files using Unix expressions?
The argument is treated literally, just like C's fopen() etc. If you want substitions, you have to perform them explicitly, e.g.: infile=open(os.path.expanduser('~/prog/py_modules/this_is_a_test'),'r') -- http://mail.python.org/mailman/listinfo/python-list