Unable To Get A Valid Pathname From Python Os.path.abspath
I have the following string containing absolute directory of a file. 'D:\Sample\Project\testXcl\data.xlsx' On passing this into os.path.abspath, I am getting the following result:
Solution 1:
When you specify the path name, either escape the backslashes or use a raw string literal:
p = 'D:\\Sample\\Project\\testXcl\\data.xlsx'
p = r'D:\Sample\Project\testXcl\data.xlsx'
Solution 2:
Use a raw string literal instead.
filename = r'D:\Sample\Project\testXcl\data.xlsx'
Post a Comment for "Unable To Get A Valid Pathname From Python Os.path.abspath"