How can I make my code work?


#1

Here is my code for the task:
my_file = open('text.txt', 'r')
print my_file.readline()
print my_file.readline()
print my_file.readline()
my_file.close()

When I hit save and submit, this error shows up on the console:
Traceback (most recent call last):
File "python", line 1, in
IOError: [Errno 2] No such file or directory: 'text.txt'

The text.txt file is open on a seperate tab. But it still doesn't work. What do I do?


#2

go to the "text.txt" tab at the top (not a browser tab)

add a " " at the very end.

go back to the script.py tab

save and submit code


#3

It really works. However, I met another problem and don't know why.

Anyone can help?