我試圖打開一個xlsx文件,只是打印它的內容。我一直運行到這個錯誤:錯誤:不支持的格式或損壞的文件:期望BOF記錄
import xlrd
book = xlrd.open_workbook("file.xlsx")
print "The number of worksheets is", book.nsheets
print "Worksheet name(s):", book.sheet_names()
print
sh = book.sheet_by_index(0)
print sh.name, sh.nrows, sh.ncols
print
print "Cell D30 is", sh.cell_value(rowx=29, colx=3)
print
for rx in range(5):
print sh.row(rx)
print
它打印出此錯誤
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found '\xff\xfeT\x00i\x00m\x00'
感謝
什麼是您的xlrd版本? – 2013-05-12 07:17:57
9.2我相信它最近的 – user2353003 2013-05-12 16:57:03