No code, a solution to the error in the path of reading CSV file by Python: filenotfounderror: [errno 2] no such file or directory: ‘XX. CSV‘

As a python Xiaobai, what I want to see most is a simple tutorial, just like a fool operation. In recent days, I have found a simple way to solve the problem of Python path error reporting.

First of all, the owner does put the code. Py file and the original data. CSV in a folder, then open Spyder and click open file – & gt; Open code.py, but the error is as follows:

After trying to use several methods mentioned on the Internet, they all have no effect

In Spyder’s navigation bar, as shown in the figure below,

Click the folder symbol on the right side of the figure above (the part circled by the red box), the following selection box will pop up, and then select the folder where your code.py is located. At this point, the path has been changed.

Finally, make sure that the path of the following two red boxes is consistent, and the code can run smoothly

Original is not easy, feel useful, please like collection forward! Grow up together on the way of self-learning Python!

The end, the flowers~


Read More: