Re: [Tutor] Editing Pickled .dat files

2006-03-04 Thread ryan luna
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. >

Re: [Tutor] Editing Pickled .dat files

2006-03-04 Thread Liam Clarke
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.

Re: [Tutor] Editing Pickled .dat files

2006-03-04 Thread ryan luna
Hey, thanks for the help but when i try i get a error Bad file descripter, here is the code im using elif choice == "2": pickle_file = open("dictionary.dat", "a") sentence = raw_input("Enter the word youd like to add: ") if sentence not in pickle_file: definitio

Re: [Tutor] Editing Pickled .dat files

2006-03-04 Thread Liam Clarke
Hi Ryan, Technically, you don't. You haul your dictionary out, as you're doing here - dictionary = cPickle.load(pickle_file) And when you're finished, you pickle it again. Regards, Liam Clarke On 3/5/06, ryan luna <[EMAIL PROTECTED]> wrote: > Hello, this is like my 3rd question today lol whi

[Tutor] Editing Pickled .dat files

2006-03-04 Thread ryan luna
Hello, this is like my 3rd question today lol which is making up for not asking any for months =P, anyways I have a pickled .dat file named dictionary, maybe youv guessed this but its a dictionary of the Alphabet, the program is a translator right now all it does is translate the Alpabet (its a stu