Q:

Python: No directory/ file when using xlrd

I have simple code:
from xlrd import open_workbook

open_workbook('Book1.xls') 

No matter how I save the file (xls or xlsx) or how I change the path to the file (C:\Users\... or C:\Users...) I keep getting:
IOError: [Errno 2] No such file or directory: '(insert whatever is in place of Book1.xls)'

I don't know what I could be doing wrong. I'm not trying anything specific yet I just want it to not throw up an error.

A:

You are not including whole path of the file. The path will be looks like:
file="C:\\USER\\TEST\\FILENAME"

or
file=r":\USER\TEST\FILENAME"

If you are using single slash then you need to use 'r' or else it will throw error.

