missing functions in os.path
Jens Bloch Helmers
helm at dnv.com
Wed Sep 25 09:36:27 EDT 2002
I hope that a future version of Python will include the following
two functions:
os.path.localpath( file ) # Returns the non-UNC name
# of file.
>>>file = r'\\computer\shared\myfile.txt'
>>>os.path.localpath( file )
'd:\somedir\shared\myfile.txt'
os.path.relpath( file, dir ) # returns the relative path of
# file relative to directory dir
>>>file = r'C:\test\mydir\hum.txt'
>>>dir = r'C:\otherdir'
>>>os.path.relpath( file, dir )
'..\test\mydir\hum.txt'
More information about the Python-list
mailing list