python读取excel测试用例报list index out of range?

我使用python写读取excel中的测试用例,在执行过程中遇到了list index out of range报错,求大佬指导

import xlrd

def get_excel(info,sheetname,casename):

# formatting_info = True 保持excel样式不被改变

testCase_excel = xlrd.open_workbook(info,formatting_info=True)

# 获取对应sheet中的一个表

testCase = testCase_excel.sheet_by_name(sheetname)

response_list = []

# 遍历从sheet表中第0列的数据

indx = 0

for one in testCase.col_values(0):

if casename in one:

requests_body = testCase.cell_value(indx, 4) # 获取sheet表中的请求数据

response_data = testCase.cell_value(indx, 5) # 获取sheet表中的返回数据

response_list.append((requests_body,response_data))

indx += 1

return response_list

if __name__ == '__main__':

res = get_excel('../data/python测试用例.xls','登录','Login')

print(res)

python读取excel测试用例报list index out of range?

以上是 python读取excel测试用例报list index out of range? 的全部内容, 来源链接: utcz.com/p/938995.html

回到顶部