5. Reading Between The Lines


my code:

my_file = open("text.txt", "r")

print my_file.readline()
print my_file.readline()
print my_file.readline()


the error I get:

Traceback (most recent call last):
File "python", line 1, in
IOError: [Errno 2] No such file or directory: 'text.txt'

I don't know what I did wrong, please can someone help me?



In the text.txt window, go into that file, type something.
It is empty at the moment.
Go back to script.py and submit.

Hope that helps.


it helped a lot and I found that if you remove the ! in the first line of text.txt, it also works. but thank you for help.


That's good news.
Now you have two ways of solving the error you experienced.:grin:


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