Example1 where path2 starts with '/' results to /dir2/dir3/ (missing path1)
path1='/Volumes/disk1/'
path2='/dir2/dir3/'
print os.path.join(path1,path2)
Example2 where path2 does NOT start with '/' results to proper /Volumes/disk1/dir2/dir3/:
path1='/Volumes/disk1/'
path2='dir2/dir3/'
print os.path.join(path1,path2)
Question: I thought the purpose of os.path.join() is allow us to avoid extra work of tedious work of verifying if it's mac, windows or linux file path: one command does it all. But now if I would have to watch if path2 starts or does not start with '/' (or '\') it ruins every hope I had and brings ton of extra code... What is the solution? I don't want to do this ugliness:
if path2 and path2.replace('\\','/')[1:] and path2.replace('\\','/').startswith('/'):
path2=path2[1:]