Removing Duplicate entries in a file...
srikar2097 at gmail.com
Fri Jan 6 17:16:13 CET 2006
Hi there, I'm just curious to know as to how the changes you have
suggested will solve the problem. Instead of appending (what I was
doing), now we are opening and storing the files in 'binary' format.
All the other entries in my file will be gone when I write into the
What I actuall need is this -
I have some dictionary values stored in a file. I retrieve these
entries based on the key value specified by the user. Now if I want to
modify the values under a particular key, I first search if that key
exists in the file and if yes retrieve the values associated with the
key and modify them. Now when I re-insert this modified key-value pair
back in the file. I have 2 entries now (one is the old wntry and the
second is the new modified one). So if I search for that key the next
time I'll have 2 entries for it. That's not what we want. So how do I
remove the old entry without the other values getting deleted ? In
other words, keeping the other entries as it is, I want to update a
particular key-value pair.
Let me know in case any bright idea strikes...
More information about the Python-list