missing functions in os.path

Simon Brunning SBrunning at trisystems.co.uk
Wed Sep 25 09:41:52 EDT 2002

> From:	Jens Bloch Helmers [SMTP:helm at dnv.com]
> 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'
A word of advice - don't use 'file' as a label - it clobbers the built-in.
>      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'
All patched gratefully received, I'm sure!

Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.

More information about the Python-list mailing list