-
What are the two things that uniquely specify a file?
name and location
-
What must you create to work with a file in Python?
a file object
-
What is the Python function that creates the thing you need to work with a file?
open
-
What two things does this function do?
creates a file object and returns a reference to it
-
What two pieces of information do you need to give this function as arguments?
pathname and access mode
-
What are the three ways you can open a file?
reading, writing, appending
-
What happens when you use the append access mode on a file?
adds text to the bottom of the file
-
If you wanted to read a SINGLE line of a file for which you had the file
variable scores_file and store it in the
variable line what Python statement
would you write?
line = scores_file.readline()
-
What is the empty string?
a string with no characters in it
-
What does readline() return when it gets to the
end of the file?
the empty string