I'm making a program that lets you input data into a CSV file and then let you search for specific customers, and delete specific customers from the system. I've done the viewing part but I can't figure out how to overwrite a specific line in the csv file. This is what I have so far:
choice = str(input("What would you like to do?"))
if choice.lower() == "delete":
Type = str(input("Type in 'Phone' to delete by Phone number and 'Name' to delete by Surnames: "))
if Type.lower() == "phone":
view = str(input("Enter the phone number of the customer you want to delete: "))
check = csv.reader(open('D:\Programming\School Work\Johns Decorating company program\Customers.csv', "rt"), delimiter=",")
for line in check:
if view in line:
print(line)
confirm = str(input("Type 'Yes' to delete all of the quotes above. Type 'No' to restart or to select in a different way"))
if confirm.lower() == "yes":
#!THIS IS WHERE I'M CONFUSED!
elif confirm.lower() == "no":
print("Restarting search")
existing()