大家好,
我想用xlrd来读excel文件,可是遇到了一些问题,请牛人指点一下。谢谢
#!/usr/bin/env python
#coding=utf-8
import xlrd
filefilter = open("fixationfilter1.txt",'a')
data=xlrd.open_workbook("try.xls")
sh=data.sheet_by_index(0)
print >>filefilter,sh.cell_value(rowx=1,colx=1)
filefilter.close()
错误报告为:
Traceback (most recent call last):
File "D:/Program Files/python 2.4.3/py2exe code/tryxlrd.py", line 7, in -toplevel-
data=xlrd.open_workbook("try.xls")
File "D:\Program Files\python 2.4.3\Lib\site-packages\xlrd\__init__.py", line 370, in open_workbook
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
File "D:\Program Files\python 2.4.3\Lib\site-packages\xlrd\__init__.py", line 1323, in getbof
raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
XLRDError: Expected BOF record; found 0x4b50
--
Best Regards,
He Jibo
jibohe2@...hejibo@...
---------------------------
He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820
Tel: 217-244-4461(office)
217-244-6763(lab)
Email:
hejibo@...
_______________________________________________
python-chinese
Post: send
python-chinese@...
Subscribe: send subscribe to
python-chinese-request@...
Unsubscribe: send unsubscribe to
python-chinese-request@...
Detail Info:
http://python.cn/mailman/listinfo/python-chinese