【问题标题】:Cannot figure out this error in python 3Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'xlrd' is not defined无法在 python 3Traceback 中找出这个错误(最近一次调用最后一次):文件“<stdin>”,第 1 行,在 <module> NameError: name 'xlrd' is not defined
【发布时间】:2019-02-25 20:34:35
【问题描述】:

我已经成功安装了 xlrd,但是,在尝试使用 xlrd 的命令时:

xlrd.open_workbook('datafile.xls')

我收到以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'xlrd' is not defined

我无法理解这个错误以及如何纠正它。

【问题讨论】:

标签: python python-3.x xlrd


【解决方案1】:

试试

使用以下命令导入 xlrd:

from xlrd import *

【讨论】:

  • 我刚使用 import xlrd 时遇到了类似的问题
猜你喜欢
  • 2022-11-27
  • 2019-04-01
  • 2022-10-13
  • 1970-01-01
  • 1970-01-01
  • 2021-11-18
  • 1970-01-01
  • 1970-01-01
  • 2020-11-07
相关资源
最近更新 更多