Text printed on the screen and text written to a file
Predict the output · Basic · §9.2 Writing to a file
Predict the output without running the code.
Code
f = open("post.txt", "w")
print("Saving started")
f.write("mina")
f.write(" 120\n")
f.write("jun 80")
print("Saving finished")
f.close()
f = open("post.txt", "r")
print(f.read())
f.close()Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.