Reading Between the Lines (phython)


#1



https://www.codecademy.com/en/courses/python-intermediate-en-OGNHh/1/1?curriculum_id=4f89dab3d788890003000096


my_file=open("text.txt","r")
print my_file.readline()
print my_file.readline()
print my_file.readline()
my_file.close()

Error

In right side window:-

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

downside error

Oops, try again. Sorry, but I'm gonna need you to refresh the page! Don't worry your code is saved.


#2

This is a known problem, but given the course gets an update soon, it won't be fixed. The forum is full of ways to solve the problem (add additional line in txt file, write to the file first using python code), did you check the forum?


#3

i found the solution , but thx
:slight_smile:


#4

Click the "Text.txt" tab, in the "Text.txt" file enter some more lines with some more data. System will save the file with name "Text.txt", then execute the actual program.


#5