File Input/Output 3/9 wierd error. Can still pass lesson


When I submit I get this error:
Traceback (most recent call last):
File "python", line 2, in
IOError: [Errno 2] No such file or directory: 'output.txt'

I can pass the lesson but it doesn't do anything useful..

my_list = [i**2 for i in range(1,11)]
my_file = open("output.txt", "r+")

for item in my_list:
    my_file.write("%s \n" % (item))


Apparently it works if I change the "r+" part with "w"...


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.