Being able to save and load files from disk is an important part of game development. Assets such as levels, player sprites, etc., are loaded from files stored on disk. Progress is saved to disk to allow players to resume their game from when they last played.
In this section we will look at the basics of file input and output as well as introduce a way to store ordered data like the dictionary container we introduced in Chapter 7.
To save and load data, your script must import the ‘os’ (short for Operating System) module to access files on the disk.