Page 171 -
P. 171
persistence
Test Drive
Let’s see what happens now that your code has been amended to use the standard pickle module instead of
your custom nester module. Load your amended code into IDLE and press F5 to run it.
Once again, you
get no visual clue
that something has
happened.
So, once again, let’s check the contents of the files to see what they look like now:
The is the man’s
pickled data.
The is the other
man’s pickled data.
It appears to have worked…but these files look like gobbledygook! What gives?
Recall that Python, not you, is pickling your data. To do so efficiently, Python’s
pickle module uses a custom binary format (known as its protocol). As you
can see, viewing this format in your editor looks decidedly weird.
Don’t worry: it is supposed to look like this.
you are here 4 135