from xlrd import open_workbook
book = open_workbook('Workbook2.xlsx')
sheet = book.sheet_by_index(0)
keys = [sheet.cell(0,col_index).value for col_index in xrange(sheet.ncols)]
dict_list =[]
print keys
for row_index in xrange(1,sheet.nrows):
d={keys[col_index]: sheet.cell(row_index, col_index).value for col_index in xrange(sheet.ncols)}
print d
dict_list.append(d)
print dict_list
输出不是excel文件的顺序。有没有人有更好的主意?