-
What does Python call the process by which an object can
be stored as a file on disk?
pickling
-
If you want to turn an object into a file on disk, what statement
must you have at the top of the script file?
import pickle
-
What access mode would you use to open a pickled file for reading?
rb
-
Write a Python statement that opens the pickle file
students.pk for reading
and assigns the result to the variable pickle_file.
pickle_file = open('students.pk', 'rb')
-
Write the name of the method you would use to read data from a pickle file.
pickle.load
-
What access mode would you use to open a pickled file for writing?
wb
-
Write a Python statement that opens the pickle file
students.pk for writing
and assigns the result to the variable pickle_file.
pickle_file = open('students.pk', 'wb')
-
Write the name of the method you would use to write data to a pickle file.
pickle.dump
-
If you have an import statement in a file defining the class, where
must that statement appear?
before the class declaration
-
If you have a statement defining a global variable
in a file defining the class, where
must that statement appear?
before the class declaration