[Tutor] Relative Paths
Lloyd Kvam
pythonTutor at venix.com
Thu May 6 15:04:19 EDT 2004
filepath = os.path.join('Database','Coordinates.txt')
filepath will have a relative path that will work from
r'c:\Student\PYTH'
While forward slashes will usually work within Windows, it can confues
people if the path appears in an error message. os.path will do the
right thing should you upgrade to Linux and keep a similar directory
structure.
On Wed, 2004-05-05 at 20:01, Krista Page wrote:
> Does anyone know how to set relative paths in Windows?
>
> For example:
>
> I have a file called C:\Student\PYTH\Database\Coordinates.txt on my machine.
> Is there anyway to just specify \Database\Coordinates.txt and have it look
> on my machine for that folder?
> I thought four backslashes would do it, but I can't seem to get it to work.
>
> Any help would be appreciated.
> Thanks
> Krista
>
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice: 603-653-8139
fax: 801-459-9582
More information about the Tutor
mailing list