Ai
1 Star 0 Fork 0

yihaohhh/Python学习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
code29.py 602 Bytes
一键复制 编辑 原始数据 按行查看 历史
yihaohhh 提交于 2025-03-04 11:32 +08:00 . py学习
# import sys
# sys.path.append(r"C:\Users\lyhhh\AppData\Local\Programs\Python\Python313\Lib\site-packages")
import xlrd
# 1. 先打开xlsx文件
xlsx = xlrd.open_workbook(r"D:\视频\learning-python\test.xlsx")
# 2. 获取指定的标签页
table = xlsx.sheet_by_index(0)
# 3. 获取到表格中有多少行
nrows = table.nrows
# 4. 进行循环统计操作
total = 0
count = 0
for i in range(1,nrows):
print('----------------------------------')
classId1 = table.cell_value(i,0)
classId2 = table.cell_value(i,1)
classId3 = table.cell_value(i,2)
print(classId1,classId2,classId3)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liu-yihao-hhh/learning-python.git
git@gitee.com:liu-yihao-hhh/learning-python.git
liu-yihao-hhh
learning-python
Python学习
master

搜索帮助