Reasons for using TXT, CSV and XML data sources
Choose a data source by structure: TXT for simple lines, CSV for tables of records, XML for nested self-describing data shared between systems. All three store data between runs.
Understanding Reasons for using TXT, CSV and XML data sources in VCE Software Development U3O1
What it does: Each line is just text with no fields or tags, so a TXT file is simple, small and quick to write. Writing to a file stores the data on disk, so it is still there after the program ends. TXT, CSV and XML all do this. CSV stores tables of records, with fields separated by commas. It works well for rows that all have the same fields, and spreadsheets can open it. XML uses tags to describe each value and can nest elements inside other elements. This makes it well suited to sharing structured data between systems. Variables are lost when a program ends. TXT, CSV and XML files all provide persistent storage between runs.
Common mistakes: strip is a method and needs brackets to run. It should be print(line.strip()). Without them the program prints a method object instead of the text line read from the TXT file. A for loop header must end with a colon. It should be for row in rows: so each CSV record is processed in turn.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 98–113) and word search (Modules 72–113).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
TXT, CSV, XMLFill in the Blanks
Spot the Error
Student with a class code? Join your class →