Skip to content

Writing to text files

Lesson 9 / 9

Lesson video

The video is not available yet.

Lesson slides

not available yet

Lesson details

Lesson outcome

I can write data to a new file and append data to an existing text file.

Show transcript
There are different modes for opening a file, r (read), w (write) and a (append). When you open a file in write mode, it creates a new file. If the file already exists then the file will be overwritten. When you open a file and write to a file in append mode, it will add to the existing contents of the file. It is good practice to close the file once written to. Some IDEs will not write to a file until it is closed.

Worksheet

not available yet

Quizzes

This quiz is not available yet.

What pupils see

The same lesson as a pupil sees it. You can set any section as work on its own.

  • IntroductionPrepare · Not available
  • Starter quizActivate · Not available
  • Lesson videoLearn · Not available
  • Exit quizCheck · Not available
This content is by Cashar and published under an open licence.