ant; MARGIN: 10px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; WORD-BREAK: break-all; PADDING-TOP: 0px"> def close(self):
#self.book.Close(SaveChanges=0)
self.book.Save()
self.book.Close()
#self.xlApp.Quit()
del self.xlApp
def read_data(self, iSheet, iRow, iCol):
try:
sht = self.book.Worksheets(iSheet)
sValue=str(sht.Cells(iRow, iCol).Value)
except:
self.close()
print('读取数据失败')
exit()
#去除'.0'
if sValue[-2:]=='.0':
sValue = sValue[0:-2]
return sValue
def write_data(self, iSheet, iRow, iCol, sData, color=OK_COLOR):
try:
sht = self.book.Worksheets(iSheet)
sht.Cells(iRow, iCol).Value = sData.decode("utf-8")
sht.Cells(iRow, iCol).Interior.Color=color
self.book.Save()
except:
self.close()
print('写入数据失败')
exit()
#获取用例个数
def get_ncase(self, iSheet):
try:
return self.get_nrows(iSheet)-self.casebegin+1
except:
文章来源于领测软件测试网 https://www.ltesting.net/