Revision tools
You can print this page for a quick reference guide or you can use the tools below to create printable test sheets
8.1: understand the difference between a text file (.txt) and a Python file (.py)
| Keyword | Definition |
|---|
| .csv file | a file which contains a table of data values separated by commas and newlines |
| .py file | a file which contains a python program which can be run |
| .txt file | a file which can contain any text data but which can't be run as a program |
8.2: be able to write code that can read from a text file
| Keyword | Definition |
|---|
| close | release resources associated with a file when it doesn't need to be used any more |
| filename | the name and location of a file to be read from or written to |
| open | access a file so that it can be read from |
| read | load data from a file |
8.3: be able to write code that can write to a text file
| Keyword | Definition |
|---|
| append | method used to write to a file where new data is added onto the end of an existing file |
| create | method used to write to a file where a new file is created if if it doesn't already exist |
| mode | the method used to open a file for writing (e.g. append, read only or create) |
| write | output data to a file |
8.4: understand how to write data structures (one-dimensional and two-dimensional arrays) to file by iteration
| Keyword | Definition |
|---|
| csv | type of file which is useful for storing data from a 2D array because each line stores multiple values separated by commas |
| index | a number which identifies the position of data within a list, array or string |
| iteration | using for or while loops to repeat a set of instructions or go through each value in a data structure such as a list |
| one dimensional array | a data structure like a list where one index is used to identify the position of a particular stored value |
| two dimensional array | a data structure like a list of lists where two indices are used to identify the position of a particular stored value |