Skip to content
Snippets Groups Projects
Select Git revision
  • 3ee8137bc1baf95129781919aa7b1986083d92d2
  • master default protected
  • loss
  • producer
4 results

Decoder.cpp

Blame
  • Reading.py 1.09 KiB
    #!/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])