I'm trying to establish the path to reading an excel table by xlrd .
But I get an answer saying that C: can not be used . How to correctly set the path of the files to be used?
import xlrd
workbook = xlrd.open_workbook("C:\Users\rdmsouza\Documents\python\programas\dados.xls")
workbook = xlrd.open_workbook("C:\Users\rdmsouza\Documents\python\programas\dados.xls", on_demand = True)
sheet.cell(0,0).value
OSError Traceback (most recent call last) in () 1 import xlrd ---- > 2 workbook = xlrd.open_workbook ("C: \ Users \ rdmsouza \ Documents \ python \ programs \ data.xls") 3 workbook = xlrd.open_workbook ("C: \ Users \ rdmsouza \ Documents \ python \ programs \ data.xls", on_demand = True) 4 sheet.cell (0,0) .value
C: \ Users \ rdmsouza \ AppData \ Local \ Continuum \ Anaconda3 \ lib \ site-packages \ xlrd__init __. py in open_workbook (filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows) 393 peek = file_contents [: peeksz] 394 else: - > 395 with open (filename, "rb") as f: 396 peek = f.read (peeksz) 397 if peek == b "PK \ x03 \ x04": # a ZIP file
OSError: [Errno 22] Invalid argument: 'C: \ Users \ rdmsouza \ Documents \ python \ programs \ data.xls'