Python how to join cross platform paths -
if have json directory structure lists paths in mac format ()i.e. "/0000_test/video.mp4"
, want join c:\\
mac format, there way this?
so on windows path returned c:\\0000_test\video.mp4"
i have tried os.path.join no avail
you can use os.path.join
, os.path.normpath
>>> os.path.normpath(os.path.join('c:', '/0000_test/video.mp4')) 'c:\\0000_test\\video.mp4'
normpath
take care of normalizing path in platform specific manner.
Comments
Post a Comment