2.3.1 Text files for input and output of data Flashcards
1
Q
Fill The Blank:
Python treats files as either ……. or ……….. depending on the …………. of the file
A
Text, Binary, Contents
2
Q
State:
When open() is used it requires two parameters, requiring the …….. ……….. and ………
A
File Name, Mode
3
Q
State:
4 different modes of opening a file
A
Append “a” - appending (editing) a file
Create “x” - create the specified file
Read “r” - open file for reading
Write “w” - open a file for writing (overwrites current contents)
4
Q
State:
How to close a file
A
{filevariablename}.close()
5
Q
Fill The Blank:
If when creating a file (using “x”) and the file ….. then it returns an error
A
Exists