'I am getting the error "FileNotFoundError: [Errno 2] No such file or directory:" and Im not able to fix it
Here is the script. I am dragging and dropping the file into the terminal when it asks for input
print("Dictionary File Path -")
filename = input()
print("Words Length -")
word_length = input()
words = list()
with open(filename) as dict:
for line in dict:
if len(line) == word_length:
list.append(line)
print(words)
I am expecting the file to go through the text file and store the words in a list and print it out and also save it in another text file.
Solution 1:[1]
As @Vas pointed out. The issue was in the directory string. I had to replace "/e/" with "E:/"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kangrew |
