os.path.normpath

Graham Dumpleton grahamd at dscpl.com.au
Wed Aug 16 18:16:24 EDT 2006


Hari Sekhon wrote ..
> grahamd at dscpl.com.au wrote:
> > nathanbullock at gmail.com wrote:
> >   
> >> I am using a windows box and passing a string like "../foo/../foo2"
> to
> >> normpath which then returns "..\\foo2". But if this string is going
> >> into a webpage link it should really be "../foo".
> >>
> >> Is there any way to tell os.path.normpath to act like we are an a unix
> >> style box?
> >>     
> >
> > Use posixpath.normpath() instead.
> >
> >   
> I can't seem to find posixpath in the docs, but I can import posixpath
> and a dir shows it does indeed have a normpath.

Quoting:

  http://www.python.org/doc/2.3.5/lib/node750.html

it says:

  posixpath
  -- Implementation of os.path on POSIX.

What it provides is therefore documented by os.path module. The posixpath
module is still accessible on non POSIX platforms though.

Graham




More information about the Python-list mailing list