Cant Finish 5.Reading Between Lines


#1

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

Ive reset code, refreshed browser, tried another browser, restarted my computer and still cant submit my answer. What should i do?


#2

The user Михаил Хухрин from Russia told me the answer.

my_file = open("text.txt", "r+")
my_file.write("I'm the first line of the file!\n")
my_file.write("I'm the second line.\n")
my_file.write("Third line here, boss.")
my_file.close()

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


#3

Same response. Still doesnt work.


#4

"Same response. Still doesnt work."+=1


#5

Try editing the text.txt tab - that worked for me, on one iteration!


#6

Confirmed, that worked for me also. Just added one space at the end of the 3rd line, and re-ran the code.


#7

Thanks sgperezcortez - that was getting annoying!


#8

Thanks for your help!


#9

just edit one of the lines, i added lol at the end of the second line in the text.txt window at the top


#10

just edit one line and hit submit, go back to code and hit submit. did the trick - appears to be a bug.


#11

answer as follows:

after typing in your code, go to the "text.txt" tab and go to the last line, insert any character. click on the script.py tab and click save. that should do the trick.


#12

This worked. Thanks!


#13

Good Solution!:grinning:


#14

Sorry I still dont get it... :sweat:


#15

try to delete everything in txt file


#16

Guys ..put each line within quotation marks in "text.txt" file like this:
"I'm the first line of the file!"
"I'm the second line."
"Third line here, boss."


#17

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


#18

just type something in text.txt and it should work


#19

It works!!! Thanks so much


#20

Thanks for the solution, guys! REALLY annoying bug though - how come it still isn't fixed?!