Lesson details

Key learning points

  1. 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?
An image in a quiz
a
r
r+
Correct answer: w
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?
An image in a quiz
Correct answer: a
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?
An image in a quiz
a
Correct answer: r
r+
w
Q4.
True or False: The readline() method always returns and additional line space at the end of it.
False
Correct answer: True

3 Questions

Q1.
True or False: You should always close a file once you have finished accessing and modifying it.
False
Correct answer: True
Q2.
True or False: Opening a file in write mode will always create a new file or overwrite an existing file.
False
Correct answer: True
Q3.
True or False: There is not a separate append method for text files.
False
Correct answer: True