I’m learning python as my first programing language and i’ve been trying to open this .txt file and it says that can’t find it
-Tried to specify as much de file direction (besides being in the same folder)
-Tried deleting the files and coding everything again
>Solution :
For future questions, please provide the code in the question as text (attaching a screenshot is fine but make sure to add the code either in the question or a pastebin link)
The problem is your working directory is set to the Curso Python folder and not Curso Python folder/Curso de dalto which actually contains the folder and file you are trying to open.
The path of the file you specified is a relative path relative path which means it’s your current working directory + the path you specified.
When running a python script, the directory you run it from is set as the default working directory. If you change your directory in the terminal using cd Curso de dalto and then run the code it should run.
Another tip, you can always check the current working directory in python using:
import os print(os.getcwd())