xhlq666 2021-05-21 20:22 采纳率: 0%
浏览 48

python求助这个问题怎么解决

import xlrd
xlsx = xlrd.open_workbook("D:/肯倍加盟工厂合作政策.xlsx")
table = xlsx.sheet_by_index(0)
#table = xlsx.sheet_by_index(0)#
print(table.cell_value(5, 1))

 

报错提示如下:

"C:\Program Files\Python38\python.exe" C:/Users/Administrator/PycharmProjects/untitled/lx.py
Traceback (most recent call last):
  File "C:/Users/Administrator/PycharmProjects/untitled/lx.py", line 2, in <module>
    xlsx = xlrd.open_workbook("D:/肯倍加盟工厂合作政策.xlsx")
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\xlrd\__init__.py", line 170, in open_workbook
    raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported

Process finished with exit code 1

求助如何修改代码。那里错误了。

  • 写回答

3条回答 默认 最新

  • CSDN专家-sinJack 2021-05-21 20:29
    关注

    xlrd读取Excel时,不太支持.xlsx,但是支持.xls

    评论

报告相同问题?

悬赏问题

  • ¥15 fastreport怎么判断当前页数
  • ¥15 Kylin-Desktop-V10-GFB-Release-JICAI_02- 2207-Build14-ARM64.iso有没有这个版本的系统啊
  • ¥15 能不能通过蓝牙将传感器数据传送到手机上
  • ¥20 100元python和数据科学实验项目
  • ¥15 根据时间在调用出列表
  • ¥15 R 包chipseeker 安装失败
  • ¥15 Veeam Backup & Replication 9.5 还原问题
  • ¥15 vue-print-nb
  • ¥15 winfrom的datagridview下拉框变成了黑色,渲染不成功
  • ¥20 利用ntfy实现短信推送