Python Creating Dictionary from excel data

后端 未结 6 713
梦毁少年i
梦毁少年i 2020-11-30 08:48

I want to create a dictionary from the values, i get from excel cells, My code is below,

wb = xlrd.open_workbook(\'foo.xls\')
sh = wb.sheet_by_index(2)   
f         


        
6条回答
  •  自闭症患者
    2020-11-30 09:34

    if you can convert it to csv this is very suitable.

    import dataconverters.commas as commas
    filename = 'test.csv'
    with open(filename) as f:
          records, metadata = commas.parse(f)
          for row in records:
                print 'this is row in dictionary:'+row
    

提交回复
热议问题