this where I am so far !

Marian poeta_sam at
Mon Dec 19 20:08:53 CET 2005

Any one who  have a clue how can I add and  remove records from a list. if the record is dictionary type)   This the program I am working on. I have no idea how can I remove and  add some more courses !
   import cPickle, shelve
  def  write_file():                                     
      CIT101 = ["Academic Computer Skills"]
      CIT111 = ["Database Management"]
      CIT115 = ["Intro to Computer scince"]
      CIT127 = ["ACCESS"]
      CIT211 = ["Systems Analysis and Design"]
      CIT216 = ["Visual Basic"]
      CIT218 = ["Intermediate Visual Basic"]
      CIT234 = ["Decision Support Using Excel"]
      pickle_file = open("pickles1.dat","w")
      cPickle.dump(CIT101, pickle_file)
      cPickle.dump(CIT111, pickle_file)
      cPickle.dump(CIT115, pickle_file)
      cPickle.dump(CIT127, pickle_file)
      cPickle.dump(CIT211, pickle_file)
      cPickle.dump(CIT216, pickle_file)
      cPickle.dump(CIT218, pickle_file)
      cPickle.dump(CIT234, pickle_file)
      print "A file has been created and the required specifications have been added"
  def read_file():
      pickle_file = open("pickles1.dat","r")
      CIT101 = cPickle.load(pickle_file)
      CIT111 = cPickle.load(pickle_file)
      CIT115 = cPickle.load(pickle_file)
      CIT127 = cPickle.load(pickle_file)
      CIT211 = cPickle.load(pickle_file)
      CIT216 = cPickle.load(pickle_file)
      CIT218 = cPickle.load(pickle_file)
      CIT234 = cPickle.load(pickle_file)
      pickles ="pickles2.dat")
      pickles["CIT101"] = ["Academic Computer Skills"]
      pickles["CIT111"] = ["Database Management"]
      pickles["CIT115"] = ["Intro to Computer scince"]
      pickles["CIT127"] = ["ACCESS"]
      pickles["CIT211"] = ["Systems Analysis and Design"]
      pickles["CIT216"] = ["Visual Basic"]
      pickles["CIT218"] = ["Intermediate Visual Basic"]
      pickles["CIT234"] = ["Decision Support Using Excel"]
      for key in pickles.keys():
          print key, "-", pickles[key]
  def dele_file():
      word_dele = raw_input("Which record do u want to delete?: ")
      if word_dele in picles.keys():
          del word_dele
          print "There is no such record in file pickles2.dat"
  def display_instructions():
      """Display the Main menue"""
      print \
          Main Manue:
            1. Exit
            2. Create a new file and add specifications
            3. (not working)Add more courses to the file
            4. Read the file
            5. (not working)Delete file
  # exit the  program                                >>> 1 <<<
  def over_program():
      """Exit the program"""
      print "Good Bye!"
  def main():
      choice = None
      while choice != 1:
          choice = raw_input("\nChoice: ")
          if choice == "1":
          elif choice == "2":
          elif choice == "3":
          elif choice == "4":
          elif choice == "5":
              print "\nSorry, but", choice, "isn't a valid choice."
  raw_input("Press Enter Key to Exit.")    

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list