--
Regards,
Eri Mendz


---------- Forwarded message ---------- Date: Sat, 4 Dec 2004 15:53:36 +0300 (Arab Standard Time) Subject: Address book sort of

Dear Tutor,

I like to know what is the proper procedure (is algorithmn the right
term?) in creating data in a program, write it to file, close the app
then retrieve the data when run again. Basically, I'm trying to simulate
a simple address book (well not really for the datas are just names for
now) and so far have created the basic menu interface. It is console
base so forget gui. I ask user input and store it in a list. There are
menus to change, delete the data, and to save the data list in file. I
use cPickle for this and have verified the file is created by checking
in my $PWD. I want to retrieve that data when program is run again. What
to add in my code? I thought not to post the code but explain it as
above.

What i want: when program is run again, the saved data is loaded when user
selects option 1 below. Of course the first time it is run, the list is
empty.

def print_options():
      print '''
      Options:
      [1] - Print content of list
      [2] - Add name to list
      [3] - Delete name from list
      [4] - Change name in list
      [5] - Save list to file
      [P] - Print this menu
      [Q] - Quit
      '''

_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to