[Tutor] Delete in .dat
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Sun Mar 5 05:19:32 CET 2006
On Sat, 4 Mar 2006, ryan luna wrote:
> My question seems like itd be farly simple but i cant seem to get it to
> work, My .dat file is a dictionary and i need to be able to only delete
> a single word and its definition, heres what i have so far but it
> doesn't work.
Hi Ryan,
By "doesn't work", what happens? Do you get an error message, or ...?
The more details here the better, since we really are not sure what the
cause of the problem is yet.
> pickle_file = open("dictionary.dat", "r")
^^^
This looks somewhat suspicious. pickle files are meant to be stored in
binary files, so you may need to open the file in binary mode:
pickle_file = open("dictionary.dat", "rb")
Otherwise, bad things may happen, especially on Windows platforms.
Good luck to you!
More information about the Tutor
mailing list