Year 11
Lesson details
Key learning points
- In this lesson, we will continue to explore text files by looking at how to write text files and how to append text files. Live coding will be used to introduce the two new concepts and mini challenges are used to allow us to test our understanding of them.
Licence
This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.
Loading...
4 Questions
Q1.
If you want to open a text file in write format, what would you put in the highlighted space in this code?
a
r
r+
Q2.
If you want to open a text file and add to that file, what would you put in the highlighted space in this code?
r
r+
w
Q3.
If you want to open a text file and read that file, what would you put in the highlighted space in this code?
a
r+
w
Q4.
True or False: The readline() method always returns and additional line space at the end of it.
False
3 Questions
Q1.
True or False: You should always close a file once you have finished accessing and modifying it.
False
Q2.
True or False: Opening a file in write mode will always create a new file or overwrite an existing file.
False
Q3.
True or False: There is not a separate append method for text files.
False