[英]How to fix the "FileNotFoundError: No such file or directory." when using Python?
So I am trying to use this Python code for a spectrograph.所以我正在尝试将这个 Python 代码用于光谱仪。 I haven't done much Python and have no clue how to fix this issue.
我没有做太多 Python 并且不知道如何解决这个问题。 As you can see in the image it says that it cant find the file, from what i understand, where its searching for it.
正如您在图片中看到的那样,它说它无法找到文件,据我所知,它在哪里搜索它。 Screenshot of the code
代码截图
I first tried fixing the problem by finding out how to move the file to where its looking for it using Shutil but i ran into the problem "SyntaxError: Unicode error" which i did not expect, probably because of my limited knowledge of python. Screenshot of error我首先尝试通过找出如何使用 Shutil 将文件移动到它寻找它的位置来解决问题,但我遇到了我没想到的问题“SyntaxError:Unicode 错误”,可能是因为我对 python 的了解有限。屏幕截图错误的
Try this试试这个
You have to convert the simple string to raw string.您必须将简单字符串转换为原始字符串。
shutil.move("Spectrograph_data.csv", r"C:Users\...")
Or replace '\'
with "\\"
.或者将
'\'
替换为"\\"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.