[Tutor] referring to subfolders

Che M pine508 at hotmail.com
Sat Jan 17 06:36:01 CET 2009




----------------------------------------
> Date: Fri, 16 Jan 2009 21:26:52 -0800
> From: steve at alchemy.com
> To: pine508 at hotmail.com
> CC: tutor at python.org
> Subject: Re: [Tutor] referring to subfolders
>
> Che M wrote:
>> I have been using absolute paths in my programs, but
>> want to get out of the habit as I try to run them on
>> other computers. I was surprised to find that this
>> type of reference didn't work:
>>
>> path = '/subfolder/myfile.py'
>
> Pathnames are relative by default. So:
> 'myfile.py'
> would be the file myfile.py in the current directory.
> 'subfolder/myfile.py'
> would be myfile.py inside subfolder, which is below the current directory.
>
> It's the initial / character which makes it absolute, and start from the
> root directory.

Thanks--much simpler!


_________________________________________________________________
Windows Live™: Keep your life in sync. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_allup_howitworks_012009


More information about the Tutor mailing list