Year 11 - Computing
Writing to CSV files
Programming: dictionaries and data files
Study Hub
This pupil-friendly study guide includes a unit summary, clear notes, common mistakes, and quick questions with answers.
Year 11 - Computing
Programming: dictionaries and data files
This unit introduces pupils to the new data structures of records and dictionaries. They will develop a Caesar cipher encryption program using a dictionary as a cipher wheel. Pupils will explore how data can be read from and written to files and how this data can be used within a program.
You will learn to write data to a new file and append data to an existing text file.
Writing to a CSV happens line-by-line in the same way as other text files. When writing to a CSV file you need to convert the data to a single string with commas used as separators.
a dynamic data structure that can contain items of different data types. Add one real device or system example to prove understanding.
Mistake: You can write integers directly to a CSV file using file.write(number). Correction: All data must be converted to strings before writing.
Browse all guides in the Year 11 Computing guide library.