【问题标题】:Unable to read an excel file in python无法在python中读取excel文件
【发布时间】:2020-04-10 12:27:11
【问题描述】:

所以我这里有一个包含许多 excel 文件的路径

path = ""
files = os.listdir(path)

for file in files:
    workbook = xlrd.open_workbook(file)

我收到此错误:

FileNotFoundError: [Errno 2] 没有这样的文件或目录:'censo2001 (1).xls'

作为参考,文件夹中的第一个文件名为“censo2001 (1)”,扩展名为 .xls。可能是什么问题呢?

【问题讨论】:

    标签: python excel


    【解决方案1】:

    尝试使用完整路径:open_workbook(path + file)

    【讨论】:

    • 成功了!谢谢!可能是什么问题?
    • 您当前的位置不是文件位置。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-08
    • 2020-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-19
    • 1970-01-01
    相关资源
    最近更新 更多