Finding the relative path of a file from a dir

Kent Johnson kent at kentsjohnson.com
Fri Jan 20 08:24:41 EST 2006


Suresh Jeevanandam wrote:
> Hi,
>     a = '/home/suresh/doc/html/a1/'
>     b = '/home/suresh/doc/'
> 
> I am looking for a standard function which will return the location of b 
> relative to a i.e. '../..'

Jason Orendorff's path module has a method for this (relpathto()).
http://www.jorendorff.com/articles/python/path/index.html

Kent



More information about the Python-list mailing list