vanlove123
vanlove123
采纳率16.7%
2020-09-01 21:44

xlrd模块错误,怎么弄

10

版本:python 3.8 xlrd 1.2.1

import xlrd
worksheet = xlrd.open_workbook('测试数据写入.xlsx')  

报错:
File "N:/untitled/临时/41.py", line 16, in
worksheet = xlrd.open_workbook('测试数据写入.xlsx') # 打开excel文件
File "D:\Python\lib\site-packages\xlrd__init__.py", line 151, in open_workbook
bk = book.open_workbook_xls(
File "D:\Python\lib\site-packages\xlrd\book.py", line 75, in open_workbook_xls
t0 = time.clock()
AttributeError: module 'time' has no attribute 'clock'

book.py:
t0 = time.clock()
    if TOGGLE_GC:
        orig_gc_enabled = gc.isenabled()
        if orig_gc_enabled:
            gc.disable()
    bk = Book()

__inlt__.py

bk = book.open_workbook_xls(
        filename=filename,
        logfile=logfile,
        verbosity=verbosity,
        use_mmap=use_mmap,
        file_contents=file_contents,
        encoding_override=encoding_override,
        formatting_info=formatting_info,
        on_demand=on_demand,
        ragged_rows=ragged_rows,
        extract_formulas=extract_formulas,
        )
    return bk

哪位大神看下啥原因 怎么办

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • caozhy 回答这么多问题就耍赖把我的积分一笔勾销了 7月前

    程序开头加上
    import time

    点赞 评论 复制链接分享
  • qq_44647926 诗与浪子 3月前

    time模块没有clock()这个方法

    点赞 评论 复制链接分享

为你推荐