python读取excel数据出错
比如说我要读取
http://basic.10jqka.com.cn/600383/xls/Important_declaredate.xls
的数据信息,用的是xlrd程序包。
import xlrd
xls= xlrd.open_workbook('Important_declaredate.xls',encoding_override='utf-8')
table=xls.sheets()[0]
print table
程序debug错误信息:
File "/Volumes/MacHD/work/stock/main.py", line 20, in main
xls= xlrd.open_workbook('Important_declaredate.xls',encoding_override='utf-8')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/__init__.py", line 435, in open_workbook
ragged_rows=ragged_rows,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 91, in open_workbook_xls
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 1258, in getbof
bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 1252, in bof_error
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found '\xd6\xb8\xb1\xea\\\xc8\xd5\xc6'
为什么会出现错误?
wxh522
11 years, 9 months ago