1 创建对象:
book = xlrd.open_workbook(‘历史记录报表.xls’)
table = book.sheet_by_index(0)
2 获取所有的行
nrow = table.nrows
3 获取所有的字段信息
for q in range(3,nrow):
num +=1
start_visit_time = table.cell(q,1).value # 访问开始时间
timeArray1 = time.strptime(start_visit_time,"%Y/%m/%d %H:%M:%S")
start_visit_time = int(time.mktime(timeArray1))
# print start_visit_time
timeArray = time.localtime(start_visit_time)
date = time.strftime("%Y%m%d", timeArray) # 访问开始日期
# print date
stay_time = table.cell(q,4).value # 停留时长
stay_time = t2s(stay_time)
友情链接:https://zhplz.com