python读取excel代码

复制代码
 1 # coding=utf-8
 2 import xlrd
 3 import xlwt
 4 import datetime
 5 
 6 import os
 7 
 8 if __name__ == '__main__':
 9     readbook = xlrd.open_workbook(r'./data/Blog记录.xlsx')
10     # sheet = readbook.sheet_by_index(1)  # 索引的方式,从0开始
11     sheet = readbook.sheet_by_name('BlogURL')  # 名字的方式
12     nrows = sheet.nrows  #
13     ncols = sheet.ncols  #
14     for i in range(nrows):
15         value_url = sheet.cell(i, 4)
16         if "microsoft" in str(value_url):
17             print(str(i),sheet.cell(i,1))
18     # print(sheet.cell(0,0))
复制代码

 

posted @   博二爷  阅读(59)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示