#!/usr/bin/python3
# coding=utf-8
#导入窗口模块
from tkinter import *
#导入多线程模块
import threading
#导入读取excel的xlrd模块
import xlrd
import datetime
import os
import sys
#创建窗口对象的背景色
root = Tk()
#创建窗口标题
root.title('幸运大抽奖.v1.0')
#创建窗口大小
root.minsize(1280, 768)
#导入excel文件
#文件位置
ExcelFile = xlrd.open_workbook(r'D:\name.xlsx')
#用索引取第一个工作薄
mysheet = ExcelFile.sheet_by_index(0)
#获取表的行数
sheetnrows = mysheet.nrows
#获取表的列数
sheetcols = mysheet.ncols
#返回结果集
''''
nos = []
for countsheet in range(sheetnrows):
if countsheet == 0: #跳过第一行
continue
for j in range(sheetcols):
ctype = mysheet.cell(countsheet, j).ctype
no = mysheet.cell(countsheet, j).value
if ctype == 2 :
no = str(int(no))
nos.append(no)
print (nos)
'''
for countsheet in range(sheetnrows):
if countsheet == 0: #跳过第一行
continue
print (mysheet.row_values(countsheet))
运行的结果:
[1033.0, '李四']
[1721.0, '张三']
期望的结果
[1033, '李四']
[1721, '张三']
新手啊!没有币啊!哭哭