Matthew Dixon Cowles
matt at mondoinfo.com
Thu Feb 22 23:12:04 CET 2001
I was a little surprised today to notice that
os.path.join("/a","/b") returns '/b'
(os.path is posixpath in this case of course) while
os.path.join("/a/","b") returns "/a/b"
which I expected from both. Poking back into my dusty archives, I find
that it has been that way since at least 1.4 so I presume that it's a
feature but I'll be darned if I can figure out the logic. It sure
doesn't seem to have much to do with joining. The module's docstring
just says "Join two or more pathname components, inserting '/' as
If someone could explain the logic to me, I'd be grateful.
More information about the Python-list