[Tutor] Searching through text with multiple answers

samhar zghaier samharzghaier at gmail.com
Sun Nov 17 11:42:37 EST 2019


Hello
I'm trying to make a search function through a small text file
i created a function to split my text and put into a list

 my goal right now is to create a search function that shows tha the
results of my search and confirms its existence in the text file. however i
do not know how to do it if a few of my elements share a name

can you help me please

This is how i am splitting my text:

def split_text():
    file_name = "text.txt"
    list_of_everything = []

    with open(file_name) as file:
        for line in file:
            list_of_everything.append(line.strip())


More information about the Tutor mailing list