
def read_xlrd(excelFile):
count = 0
data = xlrd.open_workbook(excelFile)
table = data.sheet_by_index(0)
for rowNum in range(table.nrows):
rowVale = table.row_values(rowNum)
if "hh" in rowVale:
count += 1
return count
以上代码的功能是统计字符串hh在excel表中出现的次数,excelFile是表名,rowVale得到的是excel表中的一行数据,a是统计的次数。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)