Oct-22-2019, 03:50 PM
Hello,
I am busy trying to fix my search option but i ran into some problems.
My Column names are dutch :P ID;Naam;Adres;Woonplaats
Translate into ID,Name,Adress,Place of residence
def zoeken means def search and def wijzigen means def edit
This is a part of the function below, it works on finding a name. But when I have 2 Names of the same, i want to allow the user a second input on IDnummer so he can find the right one. This way he can edit the right data.
Karsky
I am busy trying to fix my search option but i ran into some problems.
My Column names are dutch :P ID;Naam;Adres;Woonplaats
Translate into ID,Name,Adress,Place of residence
def zoeken means def search and def wijzigen means def edit
This is a part of the function below, it works on finding a name. But when I have 2 Names of the same, i want to allow the user a second input on IDnummer so he can find the right one. This way he can edit the right data.
def zoeken_op_Naam(): Naam = input("Voer een voor en achternaam in:\n") print(Naam.title()) checkNaam = open("Adressenboek.csv", "r") reader = csv.reader(checkNaam, delimiter=';') for data in reader: if Naam.title() in data: print(data) def wijzigen(): Naam = input("Voer een voor en achternaam in:\n") print(Naam.title()) CheckNaam = open("Adressenboek.csv", "r") reader = csv.reader(CheckNaam, delimiter=';') NieuwBestand = [] for data in reader: if data[1] == Naam.title(): NieuwNaam = input("Voer nieuwe naam in:\n") Naam = NieuwNaam.title() NieuwRegel = "%s,%s,%s,%s \n" %(data[0], NieuwNaam, data[2], data[3]) NieuwBestand.append(NieuwRegel) else: NieuwBestand.append(data) CheckNaam.close() CheckNaam = open("Adressenboek.csv", "w") for data in NieuwBestand: CheckNaam.write(str(data)) CheckNaam.close()Thanks,
Karsky