On Sat, Jan 17, 2009 at 12:20 AM, Che M <pine...@hotmail.com> wrote: > import os.path > self.currentdir = os.curdir > self.mysubfolder = os.path.join(self.currentdir, "subfolder") > path = self.mysubfolder + '/myfile.py' > > Is this really the only way to do it,and so I have to import > os.path each time I have a case where I refer to a subdirectory?
The advantage of os.path.join() (if you use it for all joins) is that it is portable, it will use the appropriate path separator for the platform it is running on. These days that is not such a big deal, perhaps, as Mac OSX, Windows and Linux all accept / as a path separator. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor