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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

State:

When open() is used it requires two parameters, requiring the …….. ……….. and ………

A

File Name, Mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

State:

How to close a file

A

{filevariablename}.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Fill The Blank:

If when creating a file (using “x”) and the file ….. then it returns an error

A

Exists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly