Page 165 -
P. 165
persistence
Test Drive
Before taking your code for a test drive, you need to do the following:
1. Make the necessary changes to nester and install the amended module into your Python
environment (see Chapter 2 for a refresher on this). You might want to upload to PyPI, too.
2. Amend your program so that it imports nester and uses print_lol() instead of print()
within your with statement. Note: your print_lol() invocation should look something like this:
print_lol(man, fh=man_file).
When you are ready, take your latest program for a test drive and let’s see what happens:
As before, there’s no
output on screen.
Let’s check the contents of the files to see what they look like now.
What the man
said is now
legible.
And here’s what
the other man
said.
This is looking good. By amending your nester module, you’ve provided a
facility to save your list data in a legible format. It’s now way easier on the eye.
But does this make it any easier to read the data back in?
you are here 4 129