标签:int path val 读取 xls ble name odi sheet
#coding=utf-8 import xlrd #路径前加 r,读取的文件路径 file_path = r‘D:/1.xlsx‘ #文件路径的中文转码 file_path = file_path.decode(‘utf-8‘) #获取数据 data = xlrd.open_workbook(file_path) #获取sheet table = data.sheet_by_name(‘Sheet1‘) #获取总行数 nrows = table.nrows #获取总列数 ncols = table.ncols #获取一行的数值,例如第5行 rowvalue = table.row_values(5) #获取一列的数值,例如第6列 col_values = table.col_values(6) #获取一个单元格的数值,例如第5行第6列 cell_value = table.cell(5,6).value print(rowvalue) print(col_values)
标签:int path val 读取 xls ble name odi sheet
原文地址:https://www.cnblogs.com/kongxiaoshuang/p/9977052.html