os.path.join

Elliot Peele elliot at bentlogic.net
Wed May 2 00:22:31 EDT 2007


On Tue, 2007-05-01 at 21:26 -0500, Michael Bentley wrote:
> On May 1, 2007, at 8:36 PM, Elliot Peele wrote:
> 
> > Why does os.path.join('/foo', '/bar') return '/bar' rather than
> > '/foo/bar'? That just seems rather counter intuitive.
> 
> It's the leading slash in '/bar'.  os.path.join('/foo', 'bar')  
> returns '/foo/bar'.

Right, but that seems rather counter intuitive to what os.path.join says
it should do.

"""
 join(a, *p)
        Join two or more pathname components, inserting '/' as needed
"""

Elliot




More information about the Python-list mailing list