Saturday, 28 September 2013

Python windows path slash

Python windows path slash

pI 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./p precodegt;gt;gt; x
'D:\testfolder' gt;gt;gt; print x D: estfolder gt;gt;gt; print
os.path.normpath(x) D: estfolder gt;gt;gt; print os.path.abspath(x) D:\
estfolder gt;gt;gt; print x.replace('\\','/') D: estfolder /code/pre pCan
some one please help me to fix this./p

No comments:

Post a Comment