Ohhh ok i got it to work! but why isn't the change permanent? it is "writing" to the file isn't it.
--- Liam Clarke <[EMAIL PROTECTED]> wrote: > Hi Ryan, > > You're trying to use your file, dictionary.dat like > a dictionary data > structure in Python. > They don't work the same way. > > So. > > pickle_file = open("dictionary.dat", "r") > dictionary = cPickle.load(pickle_file) > pickle_file.close() > > elif choice == "2": > pickle_file = open("dictionary.dat", "a") > sentence = raw_input("Enter the word youd > like to add: ") > if sentence not in dictionary: > definition = raw_input("Whats the > translated version: ") > dictionary[sentence] = definition > print "\n\t'",sentence,"'", "Has been > added to the dictionary." > else: > print "\n\tThat term already exists!" > > > Once you're done, you just "repickle" the > dictionary. > > pickle_file = open("dictionary.dat", "w") #Opened in > write mode > cPickle.dump(dictionary, pickle_file) > pickle_file.close() > > Regards, > > Liam Clarke > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor