File input and Output lesson 7,8,9


#1

I saw a similar thread with no response. But the output file doesn’t show any text written to it, yet we have the code passing all checks allowing us to move onto the next step. I realize nothing is printed to the screen, but shouldn’t the output file be refreshed to show the outcome?

For example in Lesson 8: Try it yourself:

My code is:

with open("text.txt", "w") as my_file:
  my_file.write("Success!")

With the output file being empty and seeing now outcome.


#2

what if you do:

with open("text.txt", "w") as my_file:
  my_file.write("Success!")

with open("text.txt", "r") as my_file:
    print my_file.readline()

does that work? The file and python are not playing along perfectly with each other within codecademy IDE. Try your local machine


#3

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