Trying to use open(filename, 'w' ) gives IOError: [Errno 2] No such file or directory if directory doesn't exist
Trying to use open(filename, 'w' ) gives IOError: [Errno 2] No such file or directory if directory doesn't exist Question: I am trying to create and write to a text file using Python. I have searched and cannot find a solution/reason for this error. Here’s the code that doesn’t work: afile = ‘D:\temp\test.txt’ outFile = …
Total answers: 3