Convert between Windows style paths and POSIX style paths

Cliff Wells LogiplexSoftware at earthlink.net
Thu Jul 10 18:15:53 EDT 2003


On Thu, 2003-07-10 at 13:44, Noah wrote:
> Does anyone have a function to convert back and forth between
> NT style paths and POSIX style? It seems trivial, but 
> I want to make sure I don't overlook some obscure detail. 
> Is it a simple matter of translating / and \ characters?
> 
> FYI, I need a Python function that does what cygpath does so that
> I can run a script on either NT or UNIX or Cygwin.
> I want my config files use one style of path.

Just use POSIX paths and let the Python library sort it out.  It works. 
If you really need to do the conversions yourself, take a look at the
os.path module.

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726  (800) 735-0555






More information about the Python-list mailing list