[Python-bugs-list] [ python-Bugs-427524 ] path formatter between unix and windows
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 29 May 2001 15:08:13 -0700
Bugs item #427524, was updated on 2001-05-26 03:13
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=427524&group_id=5470
Category: Extension Modules
Group: Feature Request
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: eXom (jkuan)
Assigned to: Paul Prescod (prescod)
Summary: path formatter between unix and windows
Initial Comment:
Is it possible to have a function that converts the
unix path format into windows format, vice versa?
Or is there any function that does that already?
e.g.
def unix2winPath(pathName, drive='C:')
raise exception if there is any invalid character in
pathName
Thanks
Joe
----------------------------------------------------------------------
>Comment By: Paul Prescod (prescod)
Date: 2001-05-29 15:08
Message:
Logged In: YES
user_id=31788
This idea is problematic. First, why would you want it? How
would a Unix path get onto Windows and vice versa? Given a
Unix path got onto Windows, why would you expect it to be
useful? i.e. what's the Windows equivalent
to /usr/sbin/foo ?
If all you want to do is reverse the slashes and append a
drive letter, I would suggest:
def unix2winpath(pathname, drive="c:"):
os.path.normpath(drive+pathname)
This will translate slashes into backslashes appropriately.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=427524&group_id=5470