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
  How to read a file as binary or hex "string" so that I can do regex search? tatahuft 3 988 Dec-19-2024, 11:57 AM
Last Post: snippsat
  Search in a file using regular expressions ADELE80 2 659 Dec-18-2024, 12:29 PM
Last Post: ADELE80
  Database search in python for MongoDB Abdul515001 0 421 Dec-14-2024, 12:31 PM
Last Post: Abdul515001
  Help Python Bot to search a database stream3366 1 579 Nov-04-2024, 11:00 PM
Last Post: stream3366
  Running search/replace across Polars dataframe columns efficiently hobbycoder 3 2,065 Oct-28-2024, 03:18 AM
Last Post: hobbycoder
  search API calls in different format pythonnewbieee 4 1,233 Sep-23-2024, 04:14 AM
Last Post: Pedroski55
  sort search results by similarity of characters jacksfrustration 5 1,673 Feb-16-2024, 11:59 PM
Last Post: deanhystad
  Basic binary search algorithm - using a while loop Drone4four 1 2,303 Jan-22-2024, 06:34 PM
Last Post: deanhystad
  AttributeError: 'NoneType' re.search philnyland 1 931 Jan-20-2024, 03:24 AM
Last Post: deanhystad
  Writing a Linear Search algorithm - malformed string representation Drone4four 10 3,977 Jan-10-2024, 08:39 AM
Last Post: gulshan212

Forum Jump:

User Panel Messages

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