
Oct. 30, 2013
7:08 p.m.
On Oct 30, 2013 11:25 AM, "MRAB" <python@mrabarnett.plus.com> wrote:
On 30/10/2013 17:06, Bruce Leban wrote:
drive, path = os.path.splitdrive(r'c:\abc') drive + os.path.join(path, r'/def/g') 'c:/def/g'
After I sent this I realized its more complicated than this. The above code will fail joining (r'C:\a\b', r'D:\x\y').
os.path.join(r'c:\abc', r'\x\y', keep_drive_unc=True) 'c:\\x\\y' os.path.join(r'\\abc\def\ghi', r'\x\y', keep_drive_unc=True) '\\\\abc\\def\\x\\y'
Shouldn't that be '\\\\abc\\x\\y'?
No. A UNC mount point is a server and a share name. \\server on its own isn't enough. E.g., \\server\C$ is the equivalent of C: --- Bruce