Yesterday I learned about a surprising (for me at least) behaviour of the os.path.join
function. Here's a quick question. What do you expect this call to return?
os.path.join("/a/b/c", "/d/e")
I expected the returned path to be /a/b/c/d/e
but that is because I looked at the input values as two strings. When you rethink it as two absolute paths the correct answer begins to make sense. The return value is /d/e
. How would you join two absolute paths? You can't so os.path.join
let the last argument win.