I am facing a very basic problem using directory path in python script. When I do copy path from the windows explorer, it uses backward slash as path seperator which is causing problem.
>>> x
'D:\testfolder'
>>> print x
D: estfolder
>>> print os.path.normpath(x)
D: estfolder
>>> print os.path.abspath(x)
D:\ estfolder
>>> print x.replace('\\','/')
D: estfolder
Can some one please help me to fix this.
normpathon windows does use\`. I personally find it easiest to use thepath` methods to combine/manage paths and then finally do a replace from\` to/` to be consistent across systems. Not sure if that answers your Q?