import xlrd class ExelUtil(object): def __init__(self, excel_path=None, index=None): if excel_path == None: excel_path = r"D:\PycharmProjects\2020study\config\case_data.xls" if index == None: index = 0 self.data = xlrd.open_workbook(excel_path) self.table = self.data.sheets()[index] # 行数 self.rows = self.table.nrows #[[],[],[]] def get_data(self): result = [] for i in range(self.rows): col = self.table.row_values(i) print(col) result.append(col) if __name__ == '__main__': ec = ExelUtil() ec.get_data()
python操作excel获取每行的数据
最新推荐文章于 2024-05-16 14:14:32 发布