Python论坛  - 讨论区

标题:[python-chinese] xlrd处理excel文件

2008年02月10日 星期日 15:47

He Jibo hejibo在gmail.com
星期日 二月 10 15:47:48 HKT 2008

´ó¼ÒºÃ£¬
     ÎÒÏëÓÃ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在cyrus.psych.uiuc.edu
hejibo在gmail.com


---------------------------
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在gmail.com
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080210/738693ed/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号