Hi everybody!
I am currently working on a low level console/text based python phonebook.
I have a working program and i can add and search entries just fine, but what I want to know is...can I remove entries?
I am using the OS package...so i 'import os' at the beginning, have some other code, like
addressbook = "phonebook.dat"
then this:
def WriteEntry_():
name = raw_input(" Enter name: ")
phone = raw_input(" Enter phone number: ")
f=open(addressbook, 'a')
f.write(name + " " + phone + '\n')
f.close()
os.fsync()
print "\n"
print " Added: " + name + " " + phone + " to the phone list.\n"
def DeleteEntry_():
name = raw_input(" Enter name to remove: ")
phone = raw_input(" Enter phone number to remove: ")
f=open(addressbook, 'a')
f.write(name + " " + phone + '\n')
f.close()
os.fsync()
print "\n"
print " Removed: " + name + " " + phone + " from the phone list.\n"
obviously I have just copied and pasted the def and changed a bit already, are thare any other variables I can change to delete a previous entry?
And pointers in the right direction would be appreciated
Kurtis