Answer the question
In order to leave comments, you need to log in
Not sure why it crashes?
I am a beginner Python programmer. Faced with the fact that the file in the directory does not want to be determined.
Here are the pictures:
Answer the question
In order to leave comments, you need to log in
The working directory is the one in which the script is run. In your case it is C:\Users\111. All relative paths are built from the working directory. That is, it open("text.txt", "r")
will try to open C:\Users\111\text.txt, while it is available at the path E:\Project_2018\text.txt Either run the script in the same directory where the required file is located, or use absolute paths, or write code to get the location of a script and build relative paths from it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question