Reputation: 33
path = input("Enter the path")
book = xlrd.open_workbook(path)
After giving path and running program, I am getting the following error:
OSError: [Errno 22] Invalid argument: '"D:\\\shreyatest1.xlsx"'
Path is: "D:\\shreyatest1.xlsx"
Upvotes: 1
Views: 148
Reputation: 311228
The \\
character is how python represents an escaped \
in a string literal. When inputting a string from the console, there's no need (read: it's wrong) to use this notation. Just input the path as you see it - D:\shreyatest1.xlsx
.
Upvotes: 1