2015年9月2日 星期三

Python os.path.join on Windows

To be pedantic, it's probably not good to hardcode either / or \ as the path separator. Maybe this would be best?
mypath = os.path.join('c:%s' % os.sep, 'sourcedir')
or
mypath = os.path.join('c:' + os.sep, 'sourcedir')

reference : http://stackoverflow.com/questions/2422798/python-os-path-join-on-windows

沒有留言:

張貼留言