Write files (Edexcel GCSE Computer Science): Flashcards

📚Flashcards
Writing files
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

12 cards from this deck

Show

What happens to data in RAM after a program ends?

Disappears forever

Purpose of writing to a file

Save data permanently so it persists after program ends

Record (in text file)

Info about one item (e.g., one prize or car)

Field (in text file)

One piece of info within a record (e.g., name, price)

Character that separates fields in text file

Commas

Line feed character notation in Python

\n

Purpose of line feed character (\n)

Creates separate lines (prevents all text on one long line)

Write mode indicator in Python open()

"w"

What write mode does to existing file content

Completely deletes it before writing new data

Purpose of str() when writing to files

Converts numbers to strings

Purpose of file.write() method

Writes the line to the file

Why close file after writing

Ensures data saved properly & frees up computer resources

Join 100,000+ GCSE students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.