Lessons written by expert teachers in England, each with slides, a video and quizzes.
Their topic:
Programming: dictionaries and data files
For your topic:
Manage Files Effectively · Information and Communication Technology (9-1) - 0983
Use these lessons alongside our lesson note, which covers your syllabus in full.
What this covers in your syllabus
Manage files.Not covered here. Our lesson note covers it.
Locate stored files Open and import files of different types Save files in a planned hierarchical directory/folder structure Save files using appropriate file names Save and print files in a variety of formats including a document, screenshots, database reports, data tables, graphs/charts, a web page in browser view, a web page in HTML view Save and export in the file format of an application package including .docx, .doc, .xlsx, .xls, .sdb, .sdc, .accdb .odb, .rtf, .pptx, .ppt Save and export in a generic file format including .csv, .txt, .rtf, .pdf, .css, .htm, .jpg, .png.Taught inLesson 1: Reading CSV files · Lesson 2: Writing to CSV files
File formats.Not covered here. Our lesson note covers it.
Characteristics and uses of file formats including css, csv, gif, htm, jpg, pdf, png, rtf, txt, zip, rar The need for generic file formats.Taught inLesson 1: Reading CSV files
2 lessons from Oak National Academy
Lesson 1 of 2 · GCSE level, ages 14 to 16
Reading CSV files
By the end:I can read and structure data in a CSV file.
CSV text files group data together on individual lines and separates values in these groups by commas.
CSV files can be read by a range of different spreadsheet software packages as well as Python files.
Each item is seperated by a comma, each record is seperated over a new row in the file.
A CSV file is the same as any other text file where each row is stored as string.
Keywords
CSV
comma-separated values are a plaintext data file where each value is separated by a single comma
tabular
displaying data in a grid of rows and columns
strip()
a Python method which removes any leading, and trailing whitespaces or characters that you specify
split()
a Python method which is used to break a string into a list based on a specified delimiter
A common mistake
Mistake:It is not possible to interrogate a CSV file in Python without importing a specialised library.
In fact:A CSV file behaves in the same way as a txt file in Python. Data is read from the file as strings and methods can be used to remove extra characters like commas, spliting the values either side in to separate items.
Check what you learned
From Oak National Academy's exit quiz. Choose every answer that is right.
A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0.Read the licence
Lesson 2 of 2 · GCSE level, ages 14 to 16
Writing to CSV files
By the end:I can write data to a new file and append data to an existing text file.