Create a new file with code
str = input('Input text here') str += "\n" file = open('data/t.txt', 'w') file.write(str) file.close()
Everything works well, I check the data folder - there is a file. Then I change w to a to add something to the file and get the error "[Errno 2] No such file or directory". Again, changing to w - also does not work. I tried to prescribe the path in different ways, including the absolute path. It turns out just as well. When you create a new file with a code, it also creates a text file and the code stops working. The folder is not on the C drive. Tell me, please, what could be the problem?