Write files (Edexcel GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
What happens to data in RAM after a program ends?
What happens to data in RAM after a program ends?
Disappears forever
Purpose of writing to a file
Purpose of writing to a file
Save data permanently so it persists after program ends
Record (in text file)
Record (in text file)
Info about one item (e.g., one prize or car)
Field (in text file)
Field (in text file)
One piece of info within a record (e.g., name, price)
Character that separates fields in text file
Character that separates fields in text file
Commas
Line feed character notation in Python
Line feed character notation in Python
\n
Purpose of line feed character (\n)
Purpose of line feed character (\n)
Creates separate lines (prevents all text on one long line)
Write mode indicator in Python open()
Write mode indicator in Python open()
"w"
What write mode does to existing file content
What write mode does to existing file content
Completely deletes it before writing new data
Purpose of str() when writing to files
Purpose of str() when writing to files
Converts numbers to strings
Purpose of file.write() method
Purpose of file.write() method
Writes the line to the file
Why close file after writing
Why close file after writing
Ensures data saved properly & frees up computer resources
