import xlrd data = xlrd.open_workbook("databases.xls").sheet_by_name(u"mall") nrows = data.nrows ncols = data.ncols c = {} def data_mall(): for i in range(nrows): print(data.row_values(i)) # a={i:data.row_values(i)} # c.update(a) # print(a) print(data_mall())
python简单的对excel读取使用,'open_workbook("excel_name.xls").sheet_by_name(u"sheet_name")' sheet_name为工作簿的名字。