BACKGROUND: excel sheet from acquiring request url, request data, request type, the expected results
Therefore, we need to learn how to use python to obtain this information from excel
# Coding. 8 = UTF- Import to xlrd # object is created, to acquire a corresponding excel spreadsheet # read Excel rows # obtaining cell content class OperationExcel: DEF the __init__ (Self, file_name = None, sheet_id = 0): IF file_name: Self. file_name = file_name self.sheet_id = sheet_id the else : self.file_name = ' ../data.xlsx ' self.sheet_id = 0 self.data = self.get_data () DEF get_line(self): return self.data.nrows def get_cell_value(self,row,col): return self.data.cell_value(row,col) def get_data(self): data = xlrd.open_workbook(self.file_name) tables = data.sheets()[self.sheet_id] return tables if __name__ == '__main__': opers = OperationExcel() print opers.get_line() print opers.get_cell_value(1,0)