gpt4 book ai didi

python : issue running XLRD

转载 作者:行者123 更新时间:2023-12-02 04:31:07 26 4
gpt4 key购买 nike

我正在测试新安装的“xlrd”包:

#!/usr/bin/env/python

import xlrd

wb = xlrd.open_workbook('D:\excel\test.xls')

print (wb.sheets())

我通过 IDLE (Windows 7) 运行它,并收到以下错误消息:

Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "D:\excel\testxls.py", line 3, in <module>
import xlrd
File "C:\Program Files (x86)\Python33\lib\site-packages\xlrd\__init__.py", line 1187
print "EXTERNSHEET(b7-):"
^
SyntaxError: invalid syntax
>>>

对这个问题有什么想法吗?

谢谢!

最佳答案

您的 xlrd 文件似乎已损坏。因此,使用以下命令更新它:

$ python3 -m pip install --upgrade xlrd

关于 python : issue running XLRD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28106276/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com