Page 145 -
P. 145

persistence



                        Test Drive



                 Load your code into IDLE’s edit window and take it for a spin by pressing F5. Be sure to save your program into the
                 same folder that contains sketch.txt.





                                                                     The code in IDLE’s
                                                                     edit window





















           And here’s what appears
           on screen: the contents of
           the two lists.









           It worked, as expected.


                                     Surely Python’s open() BIF
                                     can open files for writing as well
                                     as reading, eh?

                                                                     Yes, it can.

                                                                     When you need to save data to a file, the
                                                                     open() BIF is all you need.

                                                                                      you are here 4    109
   140   141   142   143   144   145   146   147   148   149   150