Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. def Delete_con():
  2. contact_to_delete= input("choose name to delete from contact")
  3. with open("phonebook1.txt", "r+") as file:
  4. content = file.readlines()
  5. file.seek(0)
  6. for line in content:
  7. if not any(contact_to_delete in line):
  8. file.write(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement