os.path.join("/a","/b")
Matthew Dixon Cowles
matt at mondoinfo.com
Thu Feb 22 17:12:04 EST 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
needed".
If someone could explain the logic to me, I'd be grateful.
Regards,
Matt
More information about the Python-list
mailing list