'文件未找到错误:[Errno 2] 该绝对文件路径不存在'

2024-05-12 05:26:38 发布

您现在位置:Python中文网/ 问答频道 /正文

关于这个话题,我已经读过其他几个问题,但似乎没有一个有效。在

这是我的代码:

fileIN_csv = "C:/OpenWeatherMap_Stockholm_bulk_5years.csv"
with open(fileIN_csv) as csvfile:
    readCSV = csv.reader(csvfile, delimeter=',')

下面是文件路径的证明: File Path

具体的错误是:

^{pr2}$

Tags: 文件csvcsvfile代码aswithbulkopen
2条回答

只是一个猜测,但尝试删除结尾的.csv位。当我请求文件时,我关闭了扩展名,它可以工作。在

做什么

from pathlib import Path

file_path = Path('C:/OpenWeatherMap_Stockholm_bulk_5years.csv')
print(file_path, file_path.exists())

说什么?在

相关问题 更多 >