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))