Please . helpme with this problem


File "python", line 1
I'm the first line of the file!
SyntaxError: EOL while scanning string literal
Oops, try again. Sorry, but I'm gonna need you to refresh the page! Don't worry your code is saved.

it should have printed the lines -one after the other of this para:-
I'm the first line of the file!
I'm the second line.
Third line here, boss.

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


You need to open the text file, write on three lines, and then click the save and submit button.


did not get :confused:


They are two files in the codecademy console, so click on the other one and write on three or more lines. :slight_smile:


Some people just creating that file by program. You can try something like this:

    my_file = open("text.txt")
except FileNotFoundError:
    lines = ["I'm the first line of the file!",
        "I'm the second line.",
        "Third line here, boss."]
    f = open("text.txt", "w") # Any time we try to open file for writing (or append) open() will create file, if it doesn't exist
    for line in lines:
        f.write(line + "\n")
    my_file = open("text.txt")
    # Delete pass and put your code here. File already opened.


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