FileNotFoundError: [Errno 2] No such file or directory: 'data.xls'
时间: 2023-10-20 16:00:19 浏览: 162
数据文件.xls
根据引用内容和,报错"FileNotFoundError: [Errno 2 No such file or directory: 'data.xls'"是由于文件路径引用错误导致的。在os.listdir()中找到的文件名并不带有路径前缀,如果不是在根目录下运作,仅有文件名的文件无法正常读取。所以需要在wb.load_workbook()中提供正确的文件路径,包括路径的前缀。对于你的问题中的路径'data.xls',你需要提供正确的相对或绝对路径,以确保文件被正确读取。你可以使用绝对路径,如'E:/mlnum/neural-networks-and-deep-learning/data/data.xls'或使用正确的相对路径,如'./data/data.xls',以解决此问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [FileNotFoundError: [Errno 2] No such file or directory:解决命名文件在,但是报错找不到](https://blog.csdn.net/qq_45422096/article/details/115245543)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [FileNotFoundError: [Errno 2] No such file or directory](https://blog.csdn.net/kuake11/article/details/126111213)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文