Python读取excel参数

上一篇 / 下一篇  2017-04-27 16:50:58 / 个人分类:python

    workbook=xlrd.open_workbook(r'F:\visual studio 2010\QTAPI1.2\TEST_QTAPI1.2\TEST_QTAPI1.2\QT2.55.xlsx')

    sheetId = workbook.sheet_by_name('Sheet1');#获取测试用例所在的sheet
    for row in range (1,sheetId.nrows):
        if sheetId.cell(row,4).value.strip()!="":   #过滤掉空的excel
            TeatCaseargs=sheetId.cell(row,4).value

            TeatCaseargs1=TeatCaseargs.split("\n")[0].split("#")[2]             #提取有用参数SHFE   1#exchangeCode#SHFE
            TeatCaseargs2=TeatCaseargs.split("\n")[1].split("#")[2]
            TeatCaseargs3=TeatCaseargs.split("\n")[2].split("#")[2]
            TeatCaseargs4=TeatCaseargs.split("\n")[3].split("#")[2]
            TeatCaseargs5=TeatCaseargs.split("\n")[4].split("#")[2]
            TeatCaseargs6=TeatCaseargs.split("\n")[5].split("#")[2]
            TeatCaseargs7=TeatCaseargs.split("\n")[6].split("#")[2]
            TeatCaseargs8=TeatCaseargs.split("\n")[7].split("#")[2]
            TeatCaseargs9=TeatCaseargs.split("\n")[8].split("#")[2]
            TeatCaseargs10=TeatCaseargs.split("\n")[9].split("#")[2]

            TeatCaseId= sheetId.cell(row,0).value                                 #提取用例编号
            print TeatCaseargs

TAG: Excel excel

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-20  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 16993
  • 日志数: 18
  • 书签数: 3
  • 建立时间: 2016-03-21
  • 更新时间: 2017-09-11

RSS订阅

Open Toolbar