Concept
open() gives a file object you can read line by line or write to. The mode decides whether you read, overwrite or append, and files should always be closed when you are done.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Reading and writing files doing its job.
with open("notes.txt", "w") as f:
f.write("first line\n")
with open("notes.txt", "a") as f:
f.write("second line\n")
with open("notes.txt") as f:
for line in f:
print(line.rstrip())Opening with "w" to add to a file. Write mode truncates the file the moment it opens, so the old content is gone. Append with "a".
Your roadmap puts these before Reading and writing files, unless you already know them.
Once a session shows you understand Reading and writing files, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Reading and writing files.