Strange "feature" involving double slashes in Win98

Peter Hansen peter at engcorp.com
Tue Sep 14 16:43:46 EDT 2004


Diez B. Roggisch wrote:

>>Well, that's the problem. What's I'm supposed to do?
> 
> 
> Maybe you can go for applying os.path.join and os.path.normpath to all
> user-specified paths? I don't have windows, so I can't say how
> os.path.normpath('c://foo') behaves, but maybe its does do the job.

c:\>python
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.path.normpath('c://somepath')
'c:\\\\somepath'
 >>> os.path.abspath(os.path.normpath('c://somepath'))
'c:\\somepath'
 >>> os.path.abspath('c://somepath')
'c:\\somepath'

Seems that normpath isn't up to the job, but abspath would be... if
it doesn't cause other problems.  Since we're inherently dealing
with absolute paths for this problem, maybe it's adequate?

-Peter



More information about the Python-list mailing list