import xlrd
xlsx = xlrd.open_workbook('选课.xls')
sheet = xlsx.sheet_by_index(0)
data = sheet.cell_value(5, 1)
print(data)
结果显示
Traceback (most recent call last):
File "c:/Users/cbinh/Desktop/全部源代码+excel文件/0501/01excel/001_Excel_xlrd
读_xlwt写/尝试.py", line 2, in <module>
xlsx = xlrd.open_workbook('选课.xls')
File "C:\Users\cbinh\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\xlrd\__init__.py", line 166, in open_workbook
file_format = inspect_format(filename, file_contents)
File "C:\Users\cbinh\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\xlrd\__init__.py", line 60, in inspect_format
with open(path, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '选课.xls'
这是什么原因导致的呀