Skip to content
Snippets Groups Projects
Commit ef51236c authored by PENG MacAir's avatar PENG MacAir
Browse files

DTOM 1 version

parents
1 merge request!1Master
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 17:24:31 2020
@author: taopeng
"""
import xlrd
def excel_data(file):
# 打开Excel文件读取数据
data = xlrd.open_workbook(file)
# 获取第一个工作表
table = data.sheet_by_index(3)
# 获取行数
nrows = table.nrows
# 获取列数
ncols = table.ncols
# 定义excel_list
excel_list = []
for row in range(1, nrows):
myRow = []
for col in range(ncols):
# 获取单元格数据
cell_value = table.cell(row, col).value
# 把数据追加到excel_list中
myRow.append(cell_value)
excel_list.append(myRow)
return excel_list
mylist = excel_data('ourExcel.xlsx')
for i in range(0,len(mylist)):
if i < 5:
print(mylist[i])
# we select client whose 18 < age < 50, that means bd 1950-2002
import time
for i in range(0,len(mylist)):
if i < 5 and i >1:
# myTime = timeArray = time.strptime(int(mylist[i][5]), "%Y-%m-%d %H:%M:%S")
print(mylist[i])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment