1 #-*- coding: UTF-8 -*- 2 import xlrd 3 4 5 def trim_cols(index=0): 6 fileHandler = xlrd.open_workbook("company_gongyong.xlsx") 7 page = fileHandler.sheet_by_name(u"Sheet1") 8 col1 = page.col_values(index) 9 print col1[0:10] 10 zidian={} 11 for item in col1: 12 if item ==u"哈哈": 13 print item 14 nrow=col1.index(item) 15 cell_value = page.cell(nrow,0).value 16 zidian[cell_value]=nrow 17 print nrow 18 print cell_value 19 print zidian 20 # 21 22 23 def main(): 24 trim_cols() 25 26 if __name__ == "__main__": 27 main()
时间: 2024-10-07 09:34:44