Python Forum
How to search with 2 search terms
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to search with 2 search terms
#1
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.


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
Reply
#2
you may want to look at this package: https://pypi.org/project/acora/
Reply
#3
(Oct-22-2019, 06:21 PM)Larz60+ Wrote: you may want to look at this package: https://pypi.org/project/acora/

Hello im only aloud to use python3.6 basic function to get this done.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  sort search results by similarity of characters jacksfrustration 5 430 Feb-16-2024, 11:59 PM
Last Post: deanhystad
  Basic binary search algorithm - using a while loop Drone4four 1 348 Jan-22-2024, 06:34 PM
Last Post: deanhystad
  AttributeError: 'NoneType' re.search philnyland 1 283 Jan-20-2024, 03:24 AM
Last Post: deanhystad
  Writing a Linear Search algorithm - malformed string representation Drone4four 10 926 Jan-10-2024, 08:39 AM
Last Post: gulshan212
  Search Excel File with a list of values huzzug 4 1,216 Nov-03-2023, 05:35 PM
Last Post: huzzug
  Search for multiple unknown 3 (2) Byte combinations in a file. lastyle 7 1,316 Aug-14-2023, 02:28 AM
Last Post: deanhystad
  Website Search Assistance Needed CaptianNewb 15 1,893 Aug-03-2023, 12:08 PM
Last Post: snippsat
  Search Outlook Inbox for set of values cubangt 1 1,052 Jun-28-2023, 09:29 PM
Last Post: cubangt
  Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att Melcu54 9 1,460 Jun-28-2023, 11:13 AM
Last Post: Melcu54
  search an element in pandas series learningPython 5 1,405 Apr-30-2023, 08:34 AM
Last Post: learningPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020